additional functionality added
diff --git a/org.eclipse.emf.refactor.refactoring/META-INF/MANIFEST.MF b/org.eclipse.emf.refactor.refactoring/META-INF/MANIFEST.MF
index 46b85c8..f853634 100644
--- a/org.eclipse.emf.refactor.refactoring/META-INF/MANIFEST.MF
+++ b/org.eclipse.emf.refactor.refactoring/META-INF/MANIFEST.MF
@@ -5,6 +5,8 @@
Bundle-Version: 0.7.0.qualifier
Bundle-Activator: org.eclipse.emf.refactor.refactoring.Activator
Require-Bundle: org.eclipse.ui,
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.jdt.core;bundle-version="3.8.1",
org.eclipse.core.runtime,
org.eclipse.core.resources;bundle-version="3.8.0",
org.eclipse.emf.ecore;bundle-version="2.8.1",
diff --git a/org.eclipse.emf.refactor.refactoring/schema/refactorings.exsd b/org.eclipse.emf.refactor.refactoring/schema/refactorings.exsd
index a7fd1fc..555e41e 100644
--- a/org.eclipse.emf.refactor.refactoring/schema/refactorings.exsd
+++ b/org.eclipse.emf.refactor.refactoring/schema/refactorings.exsd
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.emf.refactor.common.groupmanagement" xmlns="http://www.w3.org/2001/XMLSchema">
+<schema targetNamespace="org.eclipse.emf.refactor" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.eclipse.emf.refactor" id="refactorings" name="org.eclipse.emf.refactor.refactorings"/>
@@ -76,7 +76,7 @@
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.emf.refactor.common.core.IController"/>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.refactor.refactoring.interfaces.IController"/>
</appinfo>
</annotation>
</attribute>
@@ -86,7 +86,7 @@
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.emf.refactor.common.core.ui.IGuiHandler"/>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler"/>
</appinfo>
</annotation>
</attribute>
diff --git a/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/core/Refactoring.java b/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/core/Refactoring.java
index af0c761..6590e49 100644
--- a/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/core/Refactoring.java
+++ b/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/core/Refactoring.java
@@ -10,14 +10,10 @@
*******************************************************************************/
package org.eclipse.emf.refactor.refactoring.core;
-import java.util.LinkedList;
-import java.util.List;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.emf.refactor.refactoring.interfaces.IController;
import org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler;
-import org.eclipse.emf.refactor.refactoring.managers.RefactoringManager;
/**
* Base class of a specific emf model refactoring.
@@ -204,30 +200,5 @@
return emfRefactoring.getName().compareTo(this.getName());
}
}
-
- /**
- * Returns the emf model refactoring with the specified id.
- * @param id Id of the emf model refactoring to be returned.
- * @return Emf model refactoring with the specified id.
- */
- public static Refactoring getById(String id){
- for (Refactoring r :
- RefactoringManager.getInstance().getRefactorings()){
- if(r.getId().equals(id)){
- return r;
- }
- }
- throw
- new IllegalArgumentException("Refactoring id does not exist!");
- }
-
- /**
- * Return a list of all registered emf model refactorings.
- * @return List of all registered emf model refactorings.
- */
- public static List<Refactoring> getRefactorings(){
- return new LinkedList<Refactoring>
- (RefactoringManager.getInstance().getRefactorings());
- }
}
diff --git a/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/core/RefactoringLoader.java b/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/core/RefactoringLoader.java
index 237b431..5bd9a1d 100644
--- a/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/core/RefactoringLoader.java
+++ b/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/core/RefactoringLoader.java
@@ -1,7 +1,6 @@
package org.eclipse.emf.refactor.refactoring.core;
-import java.util.SortedSet;
-import java.util.TreeSet;
+import java.util.LinkedList;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
@@ -15,8 +14,8 @@
* the corresponding extension point servings.
* @return Created list of Refactoring objects.
*/
- public static SortedSet<Refactoring> loadRefactorings() {
- SortedSet<Refactoring> r = new TreeSet<Refactoring>();
+ public static LinkedList<Refactoring> loadRefactorings() {
+ LinkedList<Refactoring> r = new LinkedList<Refactoring>();
IConfigurationElement[] rawRefactorings =
Platform.getExtensionRegistry()
.getConfigurationElementsFor(ExtensionPointTags.EXTENSION_POINT_NAME);
diff --git a/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/managers/ProjectManager.java b/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/managers/ProjectManager.java
new file mode 100644
index 0000000..ed716f7
--- /dev/null
+++ b/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/managers/ProjectManager.java
@@ -0,0 +1,44 @@
+package org.eclipse.emf.refactor.refactoring.managers;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+public class ProjectManager {
+
+ public static IProject getActualProjectForPropertyPage(PropertyPage page) {
+ IProject project;
+ if (page.getElement() instanceof IJavaProject) {
+ project = ((IJavaProject) page.getElement()).getProject();
+ } else {
+ project = ((IProject) page.getElement());
+ }
+ return project;
+ }
+
+ @SuppressWarnings("finally")
+ public static IProject getActualProject() {
+ IProject actualProject = null;
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ try {
+ IEditorPart editorPart = window.getActivePage().getActiveEditor();
+ if (editorPart != null) {
+ IEditorInput input = editorPart.getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ IFileEditorInput fileInput = (IFileEditorInput) input;
+ actualProject = fileInput.getFile().getProject();
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ return actualProject;
+ }
+ }
+}
diff --git a/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/managers/RefactoringManager.java b/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/managers/RefactoringManager.java
index eb133c6..acac46a 100644
--- a/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/managers/RefactoringManager.java
+++ b/org.eclipse.emf.refactor.refactoring/src/org/eclipse/emf/refactor/refactoring/managers/RefactoringManager.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.emf.refactor.refactoring.managers;
-import java.util.SortedSet;
-import java.util.TreeSet;
+import java.util.LinkedList;
import org.eclipse.emf.refactor.refactoring.core.Refactoring;
import org.eclipse.emf.refactor.refactoring.core.RefactoringLoader;
@@ -31,14 +30,13 @@
/**
* Set of all registered emf model refactorings.
*/
- private final SortedSet<Refactoring> refactorings =
- new TreeSet<Refactoring>();
+ private static LinkedList<Refactoring> refactorings = null;
/**
* Private constructor.
*/
private RefactoringManager() {
- this.refactorings.addAll(RefactoringLoader.loadRefactorings());
+ refactorings = RefactoringLoader.loadRefactorings();
System.out.println("RefactoringManager initialized!");
}
@@ -57,8 +55,23 @@
* Gets a set of all registered emf model refactorings.
* @return Set of all registered emf model refactorings.
*/
- public SortedSet<Refactoring> getRefactorings() {
+ public static LinkedList<Refactoring> getAllRefactorings() {
return refactorings;
}
+ /**
+ * Returns the emf model refactoring with the specified id.
+ * @param id Id of the emf model refactoring to be returned.
+ * @return Emf model refactoring with the specified id.
+ */
+ public static Refactoring getById(String id){
+ for (Refactoring r : refactorings){
+ if(r.getId().equals(id)) {
+ return r;
+ }
+ }
+ throw
+ new IllegalArgumentException("Refactoring id does not exist!");
+ }
+
}