Author: max.andersen(a)jboss.com
Date: 2007-10-21 11:57:17 -0400 (Sun, 21 Oct 2007)
New Revision: 4401
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java
Log:
JBIDE-1135 initialize seam wizards with proper seam project
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -34,8 +34,13 @@
super(CREATE_SEAM_ACTION);
setWindowTitle(SeamUIMessages.SEAM_ACTION_WIZARD_NEW_SEAM_ACTION);
setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(SeamActionWizard.class,
"SeamFormWizBan.png")); //$NON-NLS-1$
- addPage(new SeamActionWizardPage1());
+
}
+
+ @Override
+ public void addPages() {
+ addPage(new SeamActionWizardPage1(getInitialSelection()));
+ }
public static IUndoableOperation CREATE_SEAM_ACTION = new SeamActionCreateOperation();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.jboss.tools.seam.ui.SeamUIMessages;
/**
@@ -23,22 +24,17 @@
* @param title
* @param titleImage
*/
- public SeamActionWizardPage1() {
- super("seam.new.action.page1",
SeamUIMessages.SEAM_ACTION_WIZARD_PAGE1_SEAM_ACTION, null); //$NON-NLS-1$
+ public SeamActionWizardPage1(IStructuredSelection is) {
+ super("seam.new.action.page1",
SeamUIMessages.SEAM_ACTION_WIZARD_PAGE1_SEAM_ACTION, null, is); //$NON-NLS-1$
setMessage(getDefaultMessageText());
}
-
- @Override
- protected void createEditors() {
- addEditors(SeamWizardFactory.createBaseFormFieldEditors(SeamWizardUtils.getSelectedProjectName()));
- }
+
/* (non-Javadoc)
* @see org.jboss.tools.seam.ui.wizard.SeamBaseWizardPage#getDefaultMessageText()
*/
@Override
public String getDefaultMessageText() {
- // TODO Auto-generated method stub
return "Create a new Seam action";
}
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -43,6 +43,8 @@
private IUndoableOperation operation;
private IWorkbench workbench;
+
+ private IStructuredSelection selection;
/**
*
@@ -105,9 +107,18 @@
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.workbench = workbench;
+ this.setSelection(selection);
}
protected IFacetedProjectTemplate getTemplate() {
return ProjectFacetsManager.getTemplate("template.jst.seam"); //$NON-NLS-1$
}
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+ protected IStructuredSelection getInitialSelection() {
+ return selection;
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -24,6 +24,7 @@
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
@@ -44,6 +45,8 @@
*/
public abstract class SeamBaseWizardPage extends WizardPage implements IAdaptable,
PropertyChangeListener {
+ private final IStructuredSelection initialSelection;
+
/**
*
* @param pageName
@@ -51,21 +54,23 @@
* @param titleImage
*/
public SeamBaseWizardPage(String pageName, String title,
- ImageDescriptor titleImage) {
+ ImageDescriptor titleImage, IStructuredSelection initialSelection) {
super(pageName, title, titleImage);
+ this.initialSelection = initialSelection;
createEditors();
}
/**
* @param pageName
*/
- protected SeamBaseWizardPage(String pageName) {
+ protected SeamBaseWizardPage(String pageName, IStructuredSelection initSelection) {
super(pageName);
+ this.initialSelection = initSelection;
createEditors();
}
protected void createEditors() {
- addEditors(SeamWizardFactory.createBaseFormFieldEditors(SeamWizardUtils.getSelectedProjectName()));
+ addEditors(SeamWizardFactory.createBaseFormFieldEditors(SeamWizardUtils.getRootSeamProjectName(initialSelection)));
}
Map<String,IFieldEditor> editorRegistry = new
HashMap<String,IFieldEditor>();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -16,19 +16,27 @@
import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.SeamUIMessages;
public class SeamConversationWizard extends SeamBaseWizard implements INewWizard {
+
+
public SeamConversationWizard() {
super(CREATE_SEAM_CONVERSATION);
setWindowTitle(SeamUIMessages.SEAM_CONVERSATION_WIZARD_CREATE_NEW_CONVERSATION);
- setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(SeamConversationWizard.class,
"SeamWebProjectWizBan.png"));
- addPage(new SeamConversationWizardPage1());
+ setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(SeamConversationWizard.class,
"SeamWebProjectWizBan.png"));
}
+ @Override
+ public void addPages() {
+ super.addPages();
+ addPage(new SeamConversationWizardPage1(getInitialSelection()));
+ }
public static final IUndoableOperation CREATE_SEAM_CONVERSATION = new
SeamConversationCreateOperation();
/**
*
@@ -77,5 +85,5 @@
ACTION_EAR_MAPPING.add(ACTION_WAR_MAPPING.get(2));
}
};
-
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -13,6 +13,7 @@
import java.util.Map;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.seam.ui.SeamUIMessages;
import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
@@ -24,8 +25,11 @@
*/
public class SeamConversationWizardPage1 extends SeamBaseWizardPage {
- public SeamConversationWizardPage1() {
- super("seam.new.conversation.page1",SeamUIMessages.SEAM_CONVERSATION_WIZARD_PAGE1_SEAM_CONVERSATION,null);
+ private final IStructuredSelection initialSelection;
+
+ public SeamConversationWizardPage1(IStructuredSelection initialSelection) {
+ super("seam.new.conversation.page1",SeamUIMessages.SEAM_CONVERSATION_WIZARD_PAGE1_SEAM_CONVERSATION,null,
initialSelection);
+ this.initialSelection = initialSelection;
setMessage(getDefaultMessageText());
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -33,9 +33,13 @@
super(CREATE_SEAM_ENTITY);
setWindowTitle(SeamUIMessages.SEAM_ENTITY_WIZARD_NEW_SEAM_ENTITY);
setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(SeamEntityWizard.class,
"SeamWebProjectWizBan.png"));
- addPage(new SeamEntityWizardPage1());
+
}
+ @Override
+ public void addPages() {
+ addPage(new SeamEntityWizardPage1(getInitialSelection()));
+ }
// TODO move operations to core plugin
public static final IUndoableOperation CREATE_SEAM_ENTITY = new
SeamEntityCreateOperation();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -16,6 +16,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.seam.ui.SeamUIMessages;
@@ -29,10 +30,11 @@
public class SeamEntityWizardPage1 extends SeamBaseWizardPage {
/**
+ * @param is
*
*/
- public SeamEntityWizardPage1() {
- super("seam.new.entity.page1","Seam Entity", null);
+ public SeamEntityWizardPage1(IStructuredSelection is) {
+ super("seam.new.entity.page1","Seam Entity", null, is);
setMessage(getDefaultMessageText());
}
@@ -41,7 +43,7 @@
*/
@Override
protected void createEditors() {
- addEditor(SeamWizardFactory.createSeamProjectSelectionFieldEditor(SeamWizardUtils.getSelectedProjectName()));
+ super.createEditors();
addEditor(SeamWizardFactory.createSeamEntityClasNameFieldEditor());
addEditor(SeamWizardFactory.createSeamMasterPageNameFieldEditor());
addEditor(SeamWizardFactory.createSeamPageNameFieldEditor());
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -35,8 +35,13 @@
super(CREATE_SEAM_FORM);
setWindowTitle(SeamUIMessages.SEAM_FORM_WIZARD_NEW_SEAM_FORM);
setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(SeamActionWizard.class,
"SeamFormWizBan.png")); //$NON-NLS-1$
- addPage(new SeamFormWizardPage1());
+
}
+
+ @Override
+ public void addPages() {
+ addPage(new SeamFormWizardPage1(getInitialSelection()));
+ }
private static IUndoableOperation CREATE_SEAM_FORM = new SeamFormCreateOperation();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.jboss.tools.seam.ui.SeamUIMessages;
@@ -20,17 +21,14 @@
public class SeamFormWizardPage1 extends SeamBaseWizardPage {
/**
+ * @param is
* @param pageName
*/
- public SeamFormWizardPage1() {
- super("seam.new.form.page1",SeamUIMessages.SEAM_FORM_WIZARD_PAGE1_SEAM_FORM,null);
//$NON-NLS-1$
+ public SeamFormWizardPage1(IStructuredSelection is) {
+ super("seam.new.form.page1",SeamUIMessages.SEAM_FORM_WIZARD_PAGE1_SEAM_FORM,null,
is); //$NON-NLS-1$
setMessage(getDefaultMessageText());
}
-
- @Override
- protected void createEditors() {
- addEditors(SeamWizardFactory.createBaseFormFieldEditors(SeamWizardUtils.getSelectedProjectName()));
- }
+
/* (non-Javadoc)
* @see org.jboss.tools.seam.ui.wizard.SeamBaseWizardPage#getDefaultMessageText()
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -49,7 +49,7 @@
*/
public void createControl(Composite parent) {
setPageComplete(true);
- String projectName = SeamWizardUtils.getSelectedProjectName();
+ String projectName = SeamWizardUtils.getCurrentSelectedRootSeamProjectName();
projectEditor = SeamWizardFactory.createSeamProjectSelectionFieldEditor(projectName);
projectEditor.addPropertyChangeListener(this);
if(projectName!=null && projectName.length()>0) {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -76,7 +76,7 @@
public static final IFieldEditor[] createBaseFormFieldEditors(String defaultSelection)
{
return new IFieldEditor[]{
- SeamWizardFactory.createSeamProjectSelectionFieldEditor(SeamWizardUtils.getSelectedProjectName()),
+ SeamWizardFactory.createSeamProjectSelectionFieldEditor(defaultSelection),
SeamWizardFactory.createSeamComponentNameFieldEditor(),
SeamWizardFactory.createSeamLocalInterfaceNameFieldEditor(),
SeamWizardFactory.createSeamBeanNameFieldEditor(),
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java 2007-10-21
14:17:16 UTC (rev 4400)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java 2007-10-21
15:57:17 UTC (rev 4401)
@@ -12,32 +12,96 @@
package org.jboss.tools.seam.ui.wizard;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.internal.ui.viewsupport.IViewPartInputProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
/**
- * @author eskimo
- *
+ * @author eskimo,max
+ *
*/
public class SeamWizardUtils {
/**
- * @return
+ * @return current root seam project name based on the current selection;
+ * empty string if there is no seam project to be found
*/
- public static String getSelectedProjectName() {
- ISelection sel =
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if(sel != null && sel instanceof IStructuredSelection) {
- IStructuredSelection structSel = (IStructuredSelection)sel;
- Object selElem = structSel.getFirstElement();
- if(selElem instanceof IAdaptable) {
- IProject project = (IProject)((IAdaptable)selElem).getAdapter(IProject.class);
- if(project!=null)return project.getName();
+ public static String getCurrentSelectedRootSeamProjectName() {
+ ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getSelectionService().getSelection();
+ return getRootSeamProjectName(sel);
+ }
+
+ public static String getRootSeamProjectName(ISelection sel) {
+ IProject project = getInitialProject(sel);
+ if (project != null) {
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project,
+ false);
+ if (seamProject == null) {
+ return "";
}
+
+ String parentProjectName = seamProject.getParentProjectName();
+ if (parentProjectName == null) {
+ return project.getName();
+ } else {
+ return parentProjectName;
+ }
}
- return ""; //$NON-NLS-1$
+ return "";
}
+ static private IProject getInitialProject(ISelection simpleSelection) {
+
+ IProject project = null;
+ if (simpleSelection != null && !simpleSelection.isEmpty()
+ && simpleSelection instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) simpleSelection;
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) selectedElement;
+
+ IResource resource = (IResource) adaptable
+ .getAdapter(IResource.class);
+ return resource.getProject();
+ }
+ }
+
+ if(project==null) {
+ IEditorPart activeEditor = getActivePage().getActiveEditor();
+ if(activeEditor!=null) {
+ IEditorInput input = activeEditor.getEditorInput();
+ if(input instanceof IFileEditorInput) {
+ IFileEditorInput fileInput = (IFileEditorInput) input;
+ return fileInput.getFile().getProject();
+ }
+ }
+ }
+ return project;
+ }
+
+ private static IWorkbenchPage getActivePage() {
+ IWorkbenchWindow window= getWorkbench().getActiveWorkbenchWindow();
+ if (window == null)
+ return null;
+ return getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ }
+
+ private static IWorkbench getWorkbench() {
+ return PlatformUI.getWorkbench();
+ }
+
}