Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 96271 Details for
Bug 201886
creating TPTP test but you need to have parent project created first.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch.
Defect_201886_patch.txt (text/plain), 13.52 KB, created by
Paul Slauenwhite
on 2008-04-16 11:18:11 EDT
(
hide
)
Description:
Patch.
Filename:
MIME Type:
Creator:
Paul Slauenwhite
Created:
2008-04-16 11:18:11 EDT
Size:
13.52 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.ui >Index: src/org/eclipse/hyades/ui/internal/util/UIUtil.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.ui/src/org/eclipse/hyades/ui/internal/util/UIUtil.java,v >retrieving revision 1.11 >diff -u -r1.11 UIUtil.java >--- src/org/eclipse/hyades/ui/internal/util/UIUtil.java 5 Sep 2006 22:17:59 -0000 1.11 >+++ src/org/eclipse/hyades/ui/internal/util/UIUtil.java 16 Apr 2008 15:11:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -12,12 +12,14 @@ > package org.eclipse.hyades.ui.internal.util; > > import org.eclipse.core.resources.IFile; >-import org.eclipse.hyades.ui.HyadesUIPlugin; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.jface.viewers.SelectionChangedEvent; > import org.eclipse.jface.viewers.StructuredViewer; > import org.eclipse.jface.viewers.ViewerFilter; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.VerifyEvent; >+import org.eclipse.tptp.platform.common.internal.CommonPlugin; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IEditorReference; > import org.eclipse.ui.IFileEditorInput; >@@ -25,10 +27,14 @@ > > /** > * Contains UI utility methods. >+ * <p/> > * >- * @author marcelop >- * @author popescu >- * @since 0.0.1 >+ * >+ * @author Marcelo Paternostro >+ * @author Valentina Popescu >+ * @author Paul E. Slauenwhite >+ * @version April 16, 2008 >+ * @since January 26, 2005 > */ > public class UIUtil extends org.eclipse.tptp.platform.common.ui.internal.util.UIUtil > { >@@ -47,7 +53,7 @@ > } > catch(RuntimeException e) > { >- HyadesUIPlugin.logError(e); >+ CommonPlugin.logError(e); > return false; > } > >@@ -235,7 +241,26 @@ > return null; > } > >- >- >- >+ /** >+ * Resolves the first open {@link IProject} in the workspace. >+ * <p/> >+ * In no projects exist in the workspace or all projects in >+ * the workspace are closed, <code>null</code> is returned. >+ * <p/> >+ * >+ * @return The first open {@link IProject} in the workspace, otherwise <code>null</code>. >+ */ >+ public static IProject getFirstOpenProject(){ >+ >+ IProject[] workspaceProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); >+ >+ for (int counter = 0; counter < workspaceProjects.length; counter++) { >+ >+ if(workspaceProjects[counter].isOpen()){ >+ return (workspaceProjects[counter]); >+ } >+ } >+ >+ return null; >+ } > } >\ No newline at end of file >Index: src/org/eclipse/hyades/ui/internal/wizard/HyadesNewWizard.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.ui/src/org/eclipse/hyades/ui/internal/wizard/HyadesNewWizard.java,v >retrieving revision 1.5 >diff -u -r1.5 HyadesNewWizard.java >--- src/org/eclipse/hyades/ui/internal/wizard/HyadesNewWizard.java 6 Mar 2008 22:16:20 -0000 1.5 >+++ src/org/eclipse/hyades/ui/internal/wizard/HyadesNewWizard.java 16 Apr 2008 15:11:52 -0000 >@@ -12,6 +12,7 @@ > package org.eclipse.hyades.ui.internal.wizard; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.ResourcesPlugin; >@@ -20,22 +21,28 @@ > import org.eclipse.hyades.ui.HyadesUIPlugin; > import org.eclipse.hyades.ui.internal.util.ResourceUtil; > import org.eclipse.hyades.ui.internal.util.UIUtil; >+import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.tptp.platform.common.ui.wizard.LocationPage; > import org.eclipse.ui.INewWizard; > import org.eclipse.ui.PartInitException; >+import org.eclipse.ui.actions.NewProjectAction; > > /** > * Abstract extension of the Eclipse's <code>NewWizard</code> that defines a location > * page and a "name and description" page. The subclasses are supposed to add the pages > * in the appropriate order and using the correct values for their titles and descriptions. >- * >- * <p>This implementation is based on the >+ * <p/> >+ * This implementation is based on the > * <code>org.eclipse.ui.wizards.newresource.BasicNewResourceWizard</code> class. >+ * <p/> >+ * > * >- * @author marcelop >- * @since 0.0.1 >+ * @author Marcelo Paternostro >+ * @author Paul E. Slauenwhite >+ * @version April 16, 2008 >+ * @since January 26, 2005 > */ > public abstract class HyadesNewWizard extends HyadesWizard implements INewWizard { > /* >@@ -63,24 +70,64 @@ > } > > /** >- * Adjusts the selection passed to this wizard. >- * @return IStructuredSelection >+ * Adjusts the {@link IStructuredSelection} passed to this wizard. >+ * <p/> >+ * >+ * @return The adjusted {@link IStructuredSelection}. > */ > protected IStructuredSelection adjustSeletion() { >- IStructuredSelection structuredSelection = getSelection(); >- if (getDialogSettings() != null) { >- if ((structuredSelection == null) || (structuredSelection.isEmpty())) { >- String lastSelection = getDialogSettings().get(SET_LAST_SELECTION); >- if (lastSelection != null) { >- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(lastSelection); >- if ((resource != null) && (resource.exists())) structuredSelection = new StructuredSelection(resource); >- } >- } >- } >+ >+ //Case 1: Workspace does not contain an open project so open the create project wizard (File >> New >> Project...): >+ if(UIUtil.getFirstOpenProject() == null){ >+ >+ new NewProjectAction().run(); >+ >+ IProject newProject = UIUtil.getFirstOpenProject(); >+ >+ if(newProject != null){ >+ return (new StructuredSelection(newProject)); >+ } >+ } >+ >+ IStructuredSelection structuredSelection = getSelection(); >+ >+ //Case 2: Selection contains a resource (project or folder/file) so check if accessible (open for projects and exists for folders/files): >+ if ((structuredSelection != null) && (!structuredSelection.isEmpty())) { >+ >+ IResource resource = null; >+ Object firstSelectedElement = structuredSelection.getFirstElement(); >+ >+ if(firstSelectedElement instanceof IResource){ >+ resource = ((IResource)(firstSelectedElement)); >+ } >+ else if(firstSelectedElement instanceof IJavaProject){ >+ resource = ((IJavaProject)(firstSelectedElement)).getProject(); >+ } >+ >+ if ((resource != null) && (resource.isAccessible())){ >+ return structuredSelection; >+ } >+ } >+ >+ //Case 3: Selection is null/empty so check if the last selected resource (project or folder/file) for the dialog is accessible (open for projects and exists for folders/files): >+ if (getDialogSettings() != null) { >+ >+ String lastSelection = getDialogSettings().get(SET_LAST_SELECTION); >+ >+ if (lastSelection != null) { >+ >+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(lastSelection); >+ >+ if ((resource != null) && (resource.isAccessible())){ >+ return (new StructuredSelection(resource)); >+ } >+ } >+ } > >- return structuredSelection; >+ //Case 4: Return an empty selection: >+ return (StructuredSelection.EMPTY); > } >- >+ > /** > * Returns the location page used by this wizard. > * @return LocationPage >@@ -138,6 +185,9 @@ > handleException(file.getFullPath().toString(), e); > } > >+ //Save the last selected resource (project or folder/file) for the dialog: >+ getDialogSettings().put(SET_LAST_SELECTION, getLocationPage().getContainerFullPath().toString()); >+ > return true; > } > >#P org.eclipse.tptp.test.tools.junit.plugin >Index: src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/resources/messages.properties >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.tools.junit.plugin/src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/resources/messages.properties,v >retrieving revision 1.4 >diff -u -r1.4 messages.properties >--- src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/resources/messages.properties 17 Jan 2008 19:45:57 -0000 1.4 >+++ src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/resources/messages.properties 16 Apr 2008 15:11:53 -0000 >@@ -62,6 +62,7 @@ > WORKBENCH_DETAILS_WIZPAGE_MISSING_ECLIPSE_DIRECTORY=Eclipse location is missing. > WORKBENCH_DETAILS_WIZPAGE_MISSING_WORKSPACE_DIRECTORY=Workspace location is missing. > PLUGIN_TEST_NEW_WIZARD_TITLE=New JUnit Plug-in Test >+PLUGIN_TEST_NEW_WIZARD_PLUGIN_PROJECT_ERROR=The selected source folder does not belong to a plug-in project. > #Translators: please keep the <A>...</A> delimiters in the string below! > WORKBENCH_DETAILS_WIZPAGE_TARGET_PLATFORM_LINK=The settings defined in the <A>target platform</A> will be used. > >Index: src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/resources/PluginMessages.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.tools.junit.plugin/src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/resources/PluginMessages.java,v >retrieving revision 1.3 >diff -u -r1.3 PluginMessages.java >--- src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/resources/PluginMessages.java 17 Jan 2008 19:30:32 -0000 1.3 >+++ src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/resources/PluginMessages.java 16 Apr 2008 15:11:53 -0000 >@@ -17,7 +17,7 @@ > * Plugin messages. > * > * @author Paul E. Slauenwhite >- * @version January 17, 2007 >+ * @version April 16, 2007 > * @since April 20, 2007 > */ > public class PluginMessages extends NLS { >@@ -102,7 +102,7 @@ > > public static String WORKBENCH_DETAILS_WIZPAGE_ECLIPSE_DIRECTORY; > >- public static String WORKBENCH_DETAILS_WIZPAGE_WORKSPACE_DIRECTORY; >+ public static String WORKBENCH_DETAILS_WIZPAGE_WORKSPACE_DIRECTORY; > > public static String WORKBENCH_DETAILS_WIZPAGE_OPERATING_SYSTEM; > >@@ -124,5 +124,7 @@ > > public static String WORKBENCH_DETAILS_WIZPAGE_UI_THREAD; > >+ public static String PLUGIN_TEST_NEW_WIZARD_PLUGIN_PROJECT_ERROR; >+ > public static String PluginJUnitImportWizard_title; > } >Index: src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/wizard/PluginSourcePage.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.tools.junit.plugin/src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/wizard/PluginSourcePage.java,v >retrieving revision 1.2 >diff -u -r1.2 PluginSourcePage.java >--- src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/wizard/PluginSourcePage.java 25 Apr 2007 18:51:30 -0000 1.2 >+++ src-ui/org/eclipse/tptp/test/tools/junit/plugin/internal/ui/wizard/PluginSourcePage.java 16 Apr 2008 15:11:53 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -18,16 +18,22 @@ > import org.eclipse.hyades.test.tools.ui.ToolsUiPlugin; > import org.eclipse.hyades.test.tools.ui.java.internal.junit.wizard.SourcePage; > import org.eclipse.jdt.core.IPackageFragmentRoot; >+import org.eclipse.tptp.test.tools.junit.plugin.internal.ui.resources.PluginMessages; > > /** > * Page that allows to specify the details about the generated source code >- * for a JUnit plugin test suite. >+ * for a JUnit plug-in test suite. > * This implementation is reusing the source page for regular JUnit test suites, > * with the only difference that it adds restrictions on the selected source folder >- * (the source folder must belong to a plugin project, and this plugin should have >+ * (the source folder must belong to a plug-in project, and this plug-in should have > * specific dependencies). >- * @author jcanches >- * @since 4.1 >+ * <p/> >+ * >+ * >+ * @author Julien Canches >+ * @author Paul E. Slauenwhite >+ * @version April 16, 2008 >+ * @since April 20, 2007 > */ > public class PluginSourcePage extends SourcePage { > >@@ -37,7 +43,7 @@ > > IProject project = root.getJavaProject().getProject(); > if (!PluginProjectUtil.isStrictPluginProject(project)) { >- return new Status(IStatus.ERROR, ToolsUiPlugin.getID(), 1, "The selected source folder does not belong to a plugin project", null); //$NON-NLS-1$ >+ return new Status(IStatus.ERROR, ToolsUiPlugin.getID(), 1, PluginMessages.PLUGIN_TEST_NEW_WIZARD_PLUGIN_PROJECT_ERROR, null); > } > > return super.validateProjectClasspath();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 201886
: 96271