From c82a110af4bce6797a4809313707856298c4fcd8 Mon Sep 17 00:00:00 2001
From: aschwinn <al.schwinn@gsi.de>
Date: Fri, 29 Jul 2016 10:19:39 +0200
Subject: [PATCH] Support for build in Jenkins

---
 silecs-eclipse-plugin/.classpath              |   4 +-
 silecs-eclipse-plugin/.project                |   5 -
 .../.settings/org.eclipse.jdt.core.prefs      |   1 +
 silecs-eclipse-plugin/META-INF/MANIFEST.MF    |   6 +-
 silecs-eclipse-plugin/build.properties        |   3 -
 silecs-eclipse-plugin/pom.xml                 | 195 +++++++++++-------
 .../view/ApplicationWorkbenchAdvisor.java     |  46 -----
 .../ApplicationWorkbenchWindowAdvisor.java    |  24 +--
 .../view/explorer/SilecsProjectExplorer.java  |   3 +-
 9 files changed, 143 insertions(+), 144 deletions(-)

diff --git a/silecs-eclipse-plugin/.classpath b/silecs-eclipse-plugin/.classpath
index 8cd7889..824394f 100644
--- a/silecs-eclipse-plugin/.classpath
+++ b/silecs-eclipse-plugin/.classpath
@@ -3,7 +3,7 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 	<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src/java"/>
-	<classpathentry exported="true" kind="lib" path="target/lib/xalan-2.7.2.jar"/>
-	<classpathentry exported="true" kind="lib" path="target/lib/jaxen-1.1.6.jar"/>
+	<classpathentry exported="true" kind="lib" path="jaxen-1.1.6.jar"/>
+	<classpathentry exported="true" kind="lib" path="xalan-2.7.2.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/silecs-eclipse-plugin/.project b/silecs-eclipse-plugin/.project
index 24f2a5d..5a975ee 100644
--- a/silecs-eclipse-plugin/.project
+++ b/silecs-eclipse-plugin/.project
@@ -5,11 +5,6 @@
 	<projects>
 	</projects>
 	<buildSpec>
-		<buildCommand>
-			<name>org.python.pydev.PyDevBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
 		<buildCommand>
 			<name>org.eclipse.jdt.core.javabuilder</name>
 			<arguments>
diff --git a/silecs-eclipse-plugin/.settings/org.eclipse.jdt.core.prefs b/silecs-eclipse-plugin/.settings/org.eclipse.jdt.core.prefs
index 672496e..13b3428 100644
--- a/silecs-eclipse-plugin/.settings/org.eclipse.jdt.core.prefs
+++ b/silecs-eclipse-plugin/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,6 @@
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
 org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/silecs-eclipse-plugin/META-INF/MANIFEST.MF b/silecs-eclipse-plugin/META-INF/MANIFEST.MF
index cd8d7fa..413ca60 100644
--- a/silecs-eclipse-plugin/META-INF/MANIFEST.MF
+++ b/silecs-eclipse-plugin/META-INF/MANIFEST.MF
@@ -4,6 +4,7 @@ Bundle-Name: %Bundle-Name
 Bundle-SymbolicName: silecs.eclipse.plugin;singleton:=true
 Bundle-Version: 1.1.1.qualifier
 Bundle-Activator: cern.silecs.activator.Activator
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.ui.workbench,
@@ -38,11 +39,10 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.cdt.make.core;bundle-version="7.3.0",
  org.eclipse.cdt.make.ui;bundle-version="7.2.0",
  org.eclipse.cdt.managedbuilder.core;bundle-version="8.3.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Bundle-ClassPath: .,
- target/lib/xalan-2.7.2.jar,
- target/lib/jaxen-1.1.6.jar
+ ext-jars/xalan-2.7.2.jar,
+ ext-jars/jaxen-1.1.6.jar
 Permissions: all-permissions
 Codebase: http://abwww.cern.ch/ap/dist/silecs/1.m.p/configuration/
 Application-Name: Silecs-Eclipse-Plugin
diff --git a/silecs-eclipse-plugin/build.properties b/silecs-eclipse-plugin/build.properties
index a172b18..5591dfb 100644
--- a/silecs-eclipse-plugin/build.properties
+++ b/silecs-eclipse-plugin/build.properties
@@ -5,11 +5,8 @@ bin.includes = plugin.xml,\
                META-INF/,\
                .,\
                icons/,\
-               src/scripts/,\
                JNLP-INF/,\
                src/java/,\
-               target/lib/jaxen-1.1.6.jar,\
-               target/lib/xalan-2.7.2.jar,\
                OSGI-INF/
 src.includes = src/
 jars.compile.order = .
diff --git a/silecs-eclipse-plugin/pom.xml b/silecs-eclipse-plugin/pom.xml
index dc5594a..e507277 100644
--- a/silecs-eclipse-plugin/pom.xml
+++ b/silecs-eclipse-plugin/pom.xml
@@ -2,84 +2,135 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
-        <parent>
-            <groupId>de.gsi.cs.co</groupId>
-            <artifactId>csco-parent</artifactId>
-            <version>1.0.7</version>
-        </parent>
-
-	<groupId>silecs-eclipse-plugin</groupId>
-	<artifactId>silecs-eclipse-plugin</artifactId>
-	<version>0.10.0</version>
+	<parent>
+		<groupId>de.gsi.cs.co</groupId>
+		<artifactId>csco-parent</artifactId>
+		<version>1.0.7</version>
+	</parent>
+	<groupId>de.gsi.cs.co.fe</groupId>
+	<artifactId>silecs.eclipse.plugin</artifactId>
 	<name>silecs-eclipse-plugin</name>
-	<packaging>jar</packaging>
-	<description>adfsfasfa.</description>
-	<url>sdasdasdasdasd</url>
-
-	<developers>
-		<developer>
-			<id></id>
-			<name></name>
-			<email></email>
-			<url></url>
-		</developer>
-	</developers>
+	<packaging>eclipse-plugin</packaging>
+	<version>1.1.1.qualifier</version>
+	<description>Management of Silecs projects</description>
+	<url>https://www-acc.gsi.de/wiki/Frontend/SILECS</url>
 
+	<properties>
+		<tycho-version>0.21.0</tycho-version>
+		<platform-version-name>mars</platform-version-name>
+		<eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site>
+	</properties>
+	<profiles>
+		<profile>
+			<id>platform-mars</id>
+			<activation>
+				<property>
+					<name>platform-version-name</name>
+					<value>mars</value>
+				</property>
+			</activation>
+			<properties>
+				<eclipse-site>http://download.eclipse.org/releases/mars</eclipse-site>
+				<platform-version>[4.4,4.6)</platform-version>
+				<swtbot-site>http://download.eclipse.org/technology/swtbot/mars/dev-build/update-site</swtbot-site>
+			</properties>
+		</profile>
+	</profiles>
+	<repositories>
+		<repository>
+			<id>default</id>
+			<url>https://artifacts.acc.gsi.de/nexus/content/repositories/default</url>
+		</repository>
+		<repository>
+			<id>mars</id>
+			<layout>p2</layout>
+			<url>${eclipse-site}</url>
+		</repository>
+	</repositories>
 	<dependencies>
 		<dependency>
-		  <groupId>xalan</groupId>
-		  <artifactId>xalan</artifactId>
-		  <version>2.7.2</version>
+			<groupId>xalan</groupId>
+			<artifactId>xalan</artifactId>
+			<version>2.7.2</version>
 		</dependency>
-		  <dependency>
-		  <groupId>jaxen</groupId>
-		  <artifactId>jaxen</artifactId>
-		  <version>1.1.6</version>
+		<dependency>
+			<groupId>jaxen</groupId>
+			<artifactId>jaxen</artifactId>
+			<version>1.1.6</version>
 		</dependency>
 	</dependencies>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy</id>
-            <phase>package</phase>
-            <goals>
-              <goal>copy</goal>
-            </goals>
-            <configuration>
-              <artifactItems>
-                <artifactItem>
-				  <groupId>org.slf4j</groupId>
-				  <artifactId>slf4j-log4j12</artifactId>
-                </artifactItem>
-		        <artifactItem>
-				  <groupId>org.slf4j</groupId>
-				  <artifactId>slf4j-api</artifactId>
-		        </artifactItem>
-		        <artifactItem>
-				  <groupId>log4j</groupId>
-				  <artifactId>log4j</artifactId>
-		        </artifactItem>
-                <artifactItem>
-	               	<groupId>xalan</groupId>
-		  			<artifactId>xalan</artifactId>
-		   		</artifactItem>
- 				<artifactItem>
-					<groupId>jaxen</groupId>
-					<artifactId>jaxen</artifactId>
-				</artifactItem>
-              </artifactItems>
-              <outputDirectory>${project.build.directory}/lib</outputDirectory>
-              <overWriteReleases>false</overWriteReleases>
-              <overWriteSnapshots>true</overWriteSnapshots>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
+	<build>
+		<plugins>
+			<plugin>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<version>2.10</version>
+				<configuration>
+					<pde>true</pde>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.8</source>
+					<target>1.8</target>
+					<compilerVersion>1.8</compilerVersion>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>copy-dependencies</id>
+						<phase>process-sources</phase>
+						<goals>
+							<goal>copy-dependencies</goal>
+						</goals>
+						<configuration>
+							<artifactItems>
+								<artifactItem>
+									<groupId>xalan</groupId>
+									<artifactId>xalan</artifactId>
+								</artifactItem>
+								<artifactItem>
+									<groupId>jaxen</groupId>
+									<artifactId>jaxen</artifactId>
+								</artifactItem>
+							</artifactItems>
+							<outputDirectory>${basedir}/ext-jars</outputDirectory>
+              				<overWriteReleases>false</overWriteReleases>
+              				<overWriteSnapshots>true</overWriteSnapshots>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<artifactId>maven-clean-plugin</artifactId>
+				<version>2.3</version>
+				<configuration>
+					<filesets>
+						<fileset>
+							<directory>${basedir}/ext-jars</directory>
+							<includes>
+								<include>*.jar</include>
+							</includes>
+							<followSymlinks>false</followSymlinks>
+						</fileset>
+					</filesets>
+				</configuration>
+			</plugin>
+			<plugin>
+                <groupId>org.eclipse.tycho</groupId>
+                <artifactId>tycho-maven-plugin</artifactId>
+                <version>${tycho-version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <pomDependencies>consider</pomDependencies>
+                    <executionEnvironment>JavaSE-1.8</executionEnvironment>
+                </configuration>
+            </plugin>
+		</plugins>
+	</build>
 
 </project>
diff --git a/silecs-eclipse-plugin/src/java/cern/silecs/view/ApplicationWorkbenchAdvisor.java b/silecs-eclipse-plugin/src/java/cern/silecs/view/ApplicationWorkbenchAdvisor.java
index ed4ba23..6d6f682 100644
--- a/silecs-eclipse-plugin/src/java/cern/silecs/view/ApplicationWorkbenchAdvisor.java
+++ b/silecs-eclipse-plugin/src/java/cern/silecs/view/ApplicationWorkbenchAdvisor.java
@@ -64,8 +64,6 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
         PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, false);
 
         IDE.registerAdapters();
-
-        addGenerateClassEnumListener();
     }
 
     @Override
@@ -73,48 +71,4 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
         return ResourcesPlugin.getWorkspace().getRoot();
     }
 
-    public void printClassPath() {
-        ClassLoader cl = ClassLoader.getSystemClassLoader();
-
-        URL[] urls = ((URLClassLoader)cl).getURLs();
-
-        for(URL url: urls){
-        	System.out.println(url.getFile());
-        }
-     }
-    
-    /**
-     * This methods adds a listener that should regenerate class enum whenever design project is deleted
-     */
-    private void addGenerateClassEnumListener() {
-
-        ResourcesPlugin.getWorkspace().addResourceChangeListener(new IResourceChangeListener() {
-            @Override
-            public void resourceChanged(IResourceChangeEvent event) {
-                IResourceDelta rootDelta = event.getDelta();
-                try {
-                    rootDelta.accept(delta -> {
-                        IResource resource = delta.getResource();
-
-                        // make sure that the project has been removed and it was a design project
-                            if (resource instanceof IProject
-                                    && (delta.getKind() == IResourceDelta.REMOVED || delta.getKind() == IResourceDelta.ADDED)
-                                    && resource.getName().matches(SilecsConstants.FULL_DESIGN_PATTERN)) {
-                                try {
-                                    XmlUtils.reloadDependencies();
-                                } catch (Exception e) {
-                                    e.printStackTrace();
-                                }
-
-                                return false;
-
-                            }
-                            return true;
-                        });
-                } catch (CoreException e) {
-                    e.printStackTrace();
-                }
-            }
-        }, IResourceChangeEvent.POST_CHANGE);
-    }
 }
diff --git a/silecs-eclipse-plugin/src/java/cern/silecs/view/ApplicationWorkbenchWindowAdvisor.java b/silecs-eclipse-plugin/src/java/cern/silecs/view/ApplicationWorkbenchWindowAdvisor.java
index c41468e..c8de392 100644
--- a/silecs-eclipse-plugin/src/java/cern/silecs/view/ApplicationWorkbenchWindowAdvisor.java
+++ b/silecs-eclipse-plugin/src/java/cern/silecs/view/ApplicationWorkbenchWindowAdvisor.java
@@ -160,18 +160,18 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
             }
             
             private void setApplicationTitle() {
-                IEditorPart editorPart = page.getActiveEditor();
-                IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
-                
-                if (editorPart != null) {
-                    IFileEditorInput editorInput = (IFileEditorInput) editorPart.getEditorInput();
-                    IFile file = editorInput.getFile();
-
-                    configurer.setTitle(file.getFullPath() + " - " + SilecsConstants.SILECS_NAME + " - "
-                            + ResourcesPlugin.getWorkspace());
-                } else {
-                    configurer.setTitle(SilecsConstants.SILECS_NAME + " - " + ResourcesPlugin.getWorkspace() );
-                }
+//                IEditorPart editorPart = page.getActiveEditor();
+//                IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
+//                
+//                if (editorPart != null) {
+//                    IFileEditorInput editorInput = (IFileEditorInput) editorPart.getEditorInput();
+//                    IFile file = editorInput.getFile();
+//
+//                    configurer.setTitle(file.getFullPath() + " - " + SilecsConstants.SILECS_NAME + " - "
+//                            + ResourcesPlugin.getWorkspace());
+//                } else {
+//                    configurer.setTitle(SilecsConstants.SILECS_NAME + " - " + ResourcesPlugin.getWorkspace() );
+//                }
             }
         });
 
diff --git a/silecs-eclipse-plugin/src/java/cern/silecs/view/explorer/SilecsProjectExplorer.java b/silecs-eclipse-plugin/src/java/cern/silecs/view/explorer/SilecsProjectExplorer.java
index 8ce1712..927d650 100644
--- a/silecs-eclipse-plugin/src/java/cern/silecs/view/explorer/SilecsProjectExplorer.java
+++ b/silecs-eclipse-plugin/src/java/cern/silecs/view/explorer/SilecsProjectExplorer.java
@@ -167,7 +167,8 @@ public class SilecsProjectExplorer extends CommonNavigator {
                         toExpand.add(0, parent);
                     } while ((parent = parent.getParent()) != root);
                     boolean expand = !getCommonViewer().getExpandedState(project);
-                    toExpand.forEach(o -> expand(o, expand));
+                    for(Object o: toExpand )
+                    	expand(o, expand);
                 } catch (Exception e) {
                     e.printStackTrace();
                 }
-- 
GitLab