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 141504 Details for
Bug 283402
Prototype new project wizard
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]
prototype new project wizard plus new service providers
rdt_patch.txt (text/plain), 179.24 KB, created by
Greg Watson
on 2009-07-14 08:19:33 EDT
(
hide
)
Description:
prototype new project wizard plus new service providers
Filename:
MIME Type:
Creator:
Greg Watson
Created:
2009-07-14 08:19:33 EDT
Size:
179.24 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ptp.rdt.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/plugin.xml,v >retrieving revision 1.19 >diff -u -r1.19 plugin.xml >--- plugin.xml 29 Jun 2009 15:31:58 -0000 1.19 >+++ plugin.xml 14 Jul 2009 12:09:40 -0000 >@@ -100,8 +100,8 @@ > point="org.eclipse.cdt.managedbuilder.ui.newWizardPages"> > <wizardPage > ID="org.eclipse.ptp.rdt.ui.serviceModelWizardPage" >- operationClass="org.eclipse.ptp.rdt.ui.wizards.ServiceModelWizardPageOperation" >- pageClass="org.eclipse.ptp.rdt.ui.wizards.ServiceModelWizardPage"> >+ operationClass="org.eclipse.ptp.rdt.ui.newwizards.ServiceModelWizardPageOperation" >+ pageClass="org.eclipse.ptp.rdt.ui.newwizards.ServiceModelWizardPage"> > <nature > natureID="org.eclipse.ptp.rdt.core.remoteNature"> > </nature> >@@ -116,6 +116,16 @@ > <wizard > canFinishEarly="false" > category="org.eclipse.ptp.rdt.ui.wizardCategory.Remote" >+ class="org.eclipse.ptp.rdt.ui.newwizards.NewRemoteProjectWizard" >+ hasPages="true" >+ icon="icons/etool16/newremote_c_proj.gif" >+ id="org.eclipse.ptp.rdt.ui.newRemoteProjectWizard2" >+ name="Remote Project" >+ project="true"> >+ </wizard> >+ <wizard >+ canFinishEarly="false" >+ category="org.eclipse.ptp.rdt.ui.wizardCategory.Remote" > class="org.eclipse.ptp.rdt.ui.wizards.NewRemoteCppProjectWizard" > hasPages="true" > icon="icons/etool16/newremote_c_proj.gif" >@@ -398,5 +408,126 @@ > helpId="cdt_u_prop_build_environment" > parent="org.eclipse.cdt.rdt.ui.properties.Page_Environment"/> > </extension> >+ <extension >+ id="org.eclipse.ptp.rdt.core.remoteNature" >+ name="RDT Remote Project Nature" >+ point="org.eclipse.core.resources.natures"> >+ <runtime> >+ <run >+ class="org.eclipse.ptp.rdt.core.resources.RemoteNature"> >+ </run> >+ </runtime> >+ </extension> >+ <extension >+ id="org.eclipse.ptp.rdt.ui.RemoteCIndexServiceProvider" >+ name="RDT Remote C/C++ Indexing Service" >+ point="org.eclipse.ptp.services.core.providers"> >+ <provider >+ class="org.eclipse.ptp.rdt.ui.newserviceproviders.RemoteCIndexServiceProvider" >+ id="org.eclipse.ptp.rdt.ui.RemoteCIndexServiceProvider" >+ name="%RemoteCIndexingService.name" >+ serviceId="org.eclipse.ptp.rdt.core.CIndexingService" >+ priority="1"> >+ </provider> >+ <provider >+ class="org.eclipse.ptp.rdt.ui.newserviceproviders.LocalCIndexServiceProvider" >+ id="org.eclipse.ptp.rdt.ui.LocalCIndexServiceProvider" >+ name="%LocalCIndexingService.name" >+ serviceId="org.eclipse.ptp.rdt.core.CIndexingService" >+ priority="100"> >+ </provider> >+ </extension> >+ <extension >+ point="org.eclipse.ptp.services.core.providers"> >+ <provider >+ class="org.eclipse.ptp.rdt.ui.newserviceproviders.RemoteBuildServiceProvider" >+ id="org.eclipse.ptp.rdt.ui.RemoteBuildServiceProvider" >+ name="%RemoteBuildService.name" >+ serviceId="org.eclipse.ptp.rdt.core.BuildService" >+ priority="1"> >+ </provider> >+ <provider >+ class="org.eclipse.ptp.rdt.ui.newserviceproviders.LocalBuildServiceProvider" >+ id="org.eclipse.ptp.rdt.ui.LocalBuildServiceProvider" >+ name="%LocalBuildService.name" >+ serviceId="org.eclipse.ptp.rdt.core.BuildService" >+ priority="100"> >+ </provider> >+ </extension> >+ <extension >+ point="org.eclipse.ptp.services.core.providers"> >+ <provider >+ class="org.eclipse.ptp.rdt.ui.newserviceproviders.RemoteProjectServiceProvider" >+ id="org.eclipse.ptp.rdt.ui.RemoteProjectLocationProvider" >+ name="%RemoteProjectLocationProvider.name" >+ priority="1" >+ serviceId="org.eclipse.ptp.rdt.core.ProjectLocationService"> >+ </provider> >+ <provider >+ class="org.eclipse.ptp.rdt.ui.newserviceproviders.LocalProjectServiceProvider" >+ id="org.eclipse.ptp.rdt.ui.LocalProjectLocationProvider" >+ name="%LocalProjectLocationProvider.name" >+ priority="100" >+ serviceId="org.eclipse.ptp.rdt.core.ProjectLocationService"> >+ </provider> >+ </extension> >+ <extension >+ point="org.eclipse.ptp.services.ui.providerContributors"> >+ <providerContributor >+ class="org.eclipse.ptp.rdt.ui.newwizards.RemoteServicesServiceProviderConfigurer" >+ id="org.eclipse.ptp.rdt.ui.RemoteBuildServiceProvider"> >+ </providerContributor> >+ </extension> >+ <extension >+ point="org.eclipse.ptp.services.ui.providerContributors"> >+ <providerContributor >+ class="org.eclipse.ptp.rdt.ui.newwizards.RemoteCIndexServiceProviderConfigurer" >+ id="org.eclipse.ptp.rdt.ui.RemoteCIndexServiceProvider"> >+ </providerContributor> >+ </extension> >+ <extension >+ point="org.eclipse.ptp.services.ui.providerContributors"> >+ <providerContributor >+ class="org.eclipse.ptp.rdt.ui.newwizards.RemoteProjectLocationContributor" >+ id="org.eclipse.ptp.rdt.ui.RemoteProjectLocationProvider"> >+ </providerContributor> >+ </extension> >+ <extension >+ point="org.eclipse.ptp.services.ui.serviceContributors"> >+ <serviceContributor >+ class="org.eclipse.ptp.rdt.ui.newwizards.ProjectLocationServiceContributor" >+ id="org.eclipse.ptp.rdt.core.ProjectLocationService"> >+ </serviceContributor> >+ </extension> >+ <extension >+ point="org.eclipse.ptp.services.ui.serviceContributors"> >+ <serviceContributor >+ class="org.eclipse.ptp.rdt.ui.newwizards.BuildServiceContributor" >+ id="org.eclipse.ptp.rdt.core.BuildService"> >+ </serviceContributor> >+ </extension> >+ <extension >+ point="org.eclipse.ptp.services.ui.serviceContributors"> >+ <serviceContributor >+ class="org.eclipse.ptp.rdt.ui.newwizards.CIndexingServiceContributor" >+ id="org.eclipse.ptp.rdt.core.CIndexingService"> >+ </serviceContributor> >+ </extension> >+ <extension >+ point="org.eclipse.ptp.services.ui.wizardExtensions"> >+ <wizardExtension >+ class="org.eclipse.ptp.rdt.ui.newwizards.NewHPCProjectWizard"> >+ </wizardExtension> >+ </extension> >+ <extension >+ point="org.eclipse.ui.navigator.navigatorContent"> >+ <commonWizard >+ associatedExtensionId="org.eclipse.cdt.ui.navigator.content" >+ menuGroupId="org.eclipse.cdt.ui.newProject" >+ type="new" >+ wizardId="org.eclipse.ptp.rdt.ui.newRemoteProjectWizard2"> >+ <enablement></enablement> >+ </commonWizard> >+ </extension> > > </plugin> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/plugin.properties,v >retrieving revision 1.13 >diff -u -r1.13 plugin.properties >--- plugin.properties 23 Jun 2009 15:02:32 -0000 1.13 >+++ plugin.properties 14 Jul 2009 12:09:40 -0000 >@@ -32,6 +32,12 @@ > NullBuildService.name=Null Build Service > RDTRemoteCIndexingService.name=RDT Remote C/C++ Indexing Service > RDTRemoteBuildService.name=RDT Remote Build Service >+LocalCIndexingService.name=Local-only C/C++ Indexing Service >+LocalBuildService.name=Local-only Build Service >+RemoteCIndexingService.name=Remote C/C++ Indexing Service >+RemoteBuildService.name=Remote Build Service >+LocalProjectLocationProvider.name=Local-only Project Location >+RemoteProjectLocationProvider.name=Remote Project Location > RemoteEnvironment=Remote Environment > page.remote = Remote Development > Environment = Environment >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.13 >diff -u -r1.13 MANIFEST.MF >--- META-INF/MANIFEST.MF 29 Jun 2009 15:31:58 -0000 1.13 >+++ META-INF/MANIFEST.MF 14 Jul 2009 12:09:40 -0000 >@@ -34,7 +34,9 @@ > org.eclipse.ptp.remote.core;bundle-version="2.0.1", > org.eclipse.ptp.remote.ui;bundle-version="2.0.0", > org.eclipse.ui.console;bundle-version="3.3.0", >- org.eclipse.dstore.extra;bundle-version="2.1.100" >+ org.eclipse.dstore.extra;bundle-version="2.1.100", >+ org.eclipse.ptp.services.core;bundle-version="1.0.0", >+ org.eclipse.ptp.services.ui;bundle-version="1.0.0" > Bundle-Localization: plugin > Export-Package: org.eclipse.ptp.internal.rdt.ui, > org.eclipse.ptp.internal.rdt.ui.actions, >Index: src/org/eclipse/ptp/rdt/ui/newwizards/ServiceModelWizardPageOperation.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/ServiceModelWizardPageOperation.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/ServiceModelWizardPageOperation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/ServiceModelWizardPageOperation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,67 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import java.lang.reflect.InvocationTargetException; >+ >+import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager; >+import org.eclipse.cdt.ui.wizards.ICDTCommonProjectWizard; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.SubProgressMonitor; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.ptp.services.core.IServiceConfiguration; >+ >+/** >+ * An operation which handles configuring the remote portions of the Remote C/C++ Project >+ * when the project is actually being created. >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * >+ */ >+public class ServiceModelWizardPageOperation implements IRunnableWithProgress { >+ >+ /** >+ * >+ */ >+ public ServiceModelWizardPageOperation() { >+ // TODO Auto-generated constructor stub >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ @SuppressWarnings("unchecked") >+ public void run(IProgressMonitor monitor) throws InvocationTargetException, >+ InterruptedException { >+ >+ monitor.beginTask("configure model services", 100); //$NON-NLS-1$ >+ >+ IWizard wizard = MBSCustomPageManager.getPageData(ServiceModelWizardPage.SERVICE_MODEL_WIZARD_PAGE_ID).getWizardPage().getWizard(); >+ if(wizard instanceof ICDTCommonProjectWizard) { >+ IProject project = ((ICDTCommonProjectWizard) wizard).getLastProject(); >+ >+ IServiceConfiguration config = (IServiceConfiguration)MBSCustomPageManager.getPageProperty( >+ ServiceModelWizardPage.SERVICE_MODEL_WIZARD_PAGE_ID, >+ ServiceModelWizardPage.SERVICE_CONFIGURATION_PROPERTY); >+ >+ >+ ConfigureRemoteServices.configure(project, config, new SubProgressMonitor(monitor,90)); >+ monitor.worked(10); >+ } >+ monitor.done(); >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/ProjectLocationServiceWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/ProjectLocationServiceWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/ProjectLocationServiceWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/ProjectLocationServiceWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,59 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.ptp.services.core.IService; >+import org.eclipse.ptp.services.ui.wizards.ServiceConfigurationWizardPage; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+ >+/** >+ * Allows the user to select a remote or local project configuration. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * >+ */ >+public class ProjectLocationServiceWizardPage extends ServiceConfigurationWizardPage { >+ public ProjectLocationServiceWizardPage(IService service, String pageName) { >+ super(service, pageName); >+ setTitle(pageName); >+ setDescription("This page allows you to set the location of your project source files."); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.wizards.ServiceConfigurationWizardPage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ @Override >+ public void createControl(Composite parent) { >+ Composite container = new Composite(parent, SWT.NONE); >+ >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 1; >+ container.setLayout(layout); >+ >+ Label label = new Label(container, SWT.LEFT); >+ label.setText("Choose a provider that most closely matches where your project will be located."); //$NON-NLS-1$ >+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); >+ label.setLayoutData(data); >+ >+ super.createControl(container); >+ >+ setControl(container); >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCommonProjectWizard.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCommonProjectWizard.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCommonProjectWizard.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCommonProjectWizard.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,422 @@ >+/******************************************************************************* >+ * Copyright (c) 2002, 2008 Rational Software 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Rational Software - Initial API and implementation >+ * Intel corp - rework for New Project Model >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+ >+import java.lang.reflect.InvocationTargetException; >+import java.net.URI; >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.List; >+ >+import org.eclipse.cdt.core.CCorePlugin; >+import org.eclipse.cdt.core.model.CoreModel; >+import org.eclipse.cdt.core.model.ILanguage; >+import org.eclipse.cdt.core.model.LanguageManager; >+import org.eclipse.cdt.core.settings.model.ICProjectDescription; >+import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; >+import org.eclipse.cdt.ui.CUIPlugin; >+import org.eclipse.cdt.ui.newui.UIMessages; >+import org.eclipse.cdt.ui.wizards.CWizardHandler; >+import org.eclipse.cdt.ui.wizards.ICDTCommonProjectWizard; >+import org.eclipse.cdt.ui.wizards.IWizardWithMemory; >+import org.eclipse.core.filesystem.EFS; >+import org.eclipse.core.filesystem.IFileInfo; >+import org.eclipse.core.filesystem.IFileStore; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IProjectDescription; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IWorkspace; >+import org.eclipse.core.resources.IWorkspaceRoot; >+import org.eclipse.core.resources.IWorkspaceRunnable; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExecutableExtension; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.SubProgressMonitor; >+import org.eclipse.core.runtime.content.IContentType; >+import org.eclipse.core.runtime.content.IContentTypeManager; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.ptp.rdt.services.core.ServiceModelManager; >+import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation; >+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; >+import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; >+ >+public abstract class RemoteCommonProjectWizard extends BasicNewResourceWizard >+implements IExecutableExtension, IWizardWithMemory, ICDTCommonProjectWizard >+{ >+ private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$ >+ private static final String OP_ERROR= "CProjectWizard.op_error"; //$NON-NLS-1$ >+ private static final String title= CUIPlugin.getResourceString(OP_ERROR + ".title"); //$NON-NLS-1$ >+ private static final String message= CUIPlugin.getResourceString(OP_ERROR + ".message"); //$NON-NLS-1$ >+ private static final String[] EMPTY_ARR = new String[0]; >+ >+ protected IConfigurationElement fConfigElement; >+ protected RemoteMainWizardPage fMainPage; >+ >+ protected IProject newProject; >+ private String wz_title; >+ private String wz_desc; >+ >+ private boolean existingPath = false; >+ private String lastProjectName = null; >+ private URI lastProjectLocation = null; >+ private CWizardHandler savedHandler = null; >+ >+ private ServiceModelManager manager = ServiceModelManager.getInstance(); >+ >+ public RemoteCommonProjectWizard() { >+ this(UIMessages.getString("NewModelProjectWizard.0"),UIMessages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ public RemoteCommonProjectWizard(String title, String desc) { >+ super(); >+ setDialogSettings(CUIPlugin.getDefault().getDialogSettings()); >+ setNeedsProgressMonitor(true); >+ setForcePreviousAndNextButtons(true); >+ setWindowTitle(title); >+ wz_title = title; >+ wz_desc = desc; >+ } >+ >+ @Override >+ public void addPages() { >+ fMainPage= new RemoteMainWizardPage(CUIPlugin.getResourceString(PREFIX)); >+ fMainPage.setTitle(wz_title); >+ fMainPage.setDescription(wz_desc); >+ addPage(fMainPage); >+ } >+ >+ /** >+ * @return true if user has changed settings since project creation >+ */ >+ private boolean isChanged() { >+ if (savedHandler != fMainPage.h_selected) >+ return true; >+ >+ if (!fMainPage.getProjectName().equals(lastProjectName)) >+ return true; >+ >+ URI projectLocation = fMainPage.getProjectLocation(); >+ if (projectLocation == null) { >+ if (lastProjectLocation != null) >+ return true; >+ } else if (!projectLocation.equals(lastProjectLocation)) >+ return true; >+ >+ return savedHandler.isChanged(); >+ } >+ >+ public IProject getProject(boolean defaults) { >+ return getProject(defaults, true); >+ } >+ >+ public IProject getProject(boolean defaults, boolean onFinish) { >+ if (newProject != null && isChanged()) >+ clearProject(); >+ if (newProject == null) { >+ existingPath = false; >+ try { >+ IFileStore fs; >+ URI p = fMainPage.getProjectLocation(); >+ if (p == null) { >+ fs = EFS.getStore(ResourcesPlugin.getWorkspace().getRoot().getLocationURI()); >+ fs = fs.getChild(fMainPage.getProjectName()); >+ } else >+ fs = EFS.getStore(p); >+ IFileInfo f = fs.fetchInfo(); >+ if (f.exists() && f.isDirectory()) { >+ if (fs.getChild(".project").fetchInfo().exists()) { //$NON-NLS-1$ >+ if (! >+ MessageDialog.openConfirm(getShell(), >+ UIMessages.getString("CDTCommonProjectWizard.0"), //$NON-NLS-1$ >+ UIMessages.getString("CDTCommonProjectWizard.1")) //$NON-NLS-1$ >+ ) >+ return null; >+ } >+ existingPath = true; >+ } >+ } catch (CoreException e) { >+ CUIPlugin.log(e.getStatus()); >+ } >+ savedHandler = fMainPage.h_selected; >+ savedHandler.saveState(); >+ lastProjectName = fMainPage.getProjectName(); >+ lastProjectLocation = fMainPage.getProjectLocation(); >+ // start creation process >+ invokeRunnable(getRunnable(defaults, onFinish)); >+ } >+ return newProject; >+ } >+ >+ /** >+ * Remove created project either after error >+ * or if user returned back from config page. >+ */ >+ private void clearProject() { >+ if (lastProjectName == null) return; >+ try { >+ ResourcesPlugin.getWorkspace().getRoot().getProject(lastProjectName).delete(!existingPath, true, null); >+ } catch (CoreException ignore) {} >+ if (newProject != null) { >+ manager.remove(newProject); >+ } >+ newProject = null; >+ lastProjectName = null; >+ lastProjectLocation = null; >+ } >+ >+ private boolean invokeRunnable(IRunnableWithProgress runnable) { >+ IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(runnable); >+ try { >+ getContainer().run(true, true, op); >+ } catch (InvocationTargetException e) { >+ CUIPlugin.errorDialog(getShell(), title, message, e.getTargetException(), false); >+ clearProject(); >+ return false; >+ } catch (InterruptedException e) { >+ clearProject(); >+ return false; >+ } >+ return true; >+ } >+ >+ @Override >+ public boolean performFinish() { >+ boolean needsPost = (newProject != null && !isChanged()); >+ // create project if it is not created yet >+ if (getProject(fMainPage.isCurrent(), true) == null) >+ return false; >+ fMainPage.h_selected.postProcess(newProject, needsPost); >+ try { >+ setCreated(); >+ } catch (CoreException e) { >+ e.printStackTrace(); >+ return false; >+ } >+ BasicNewProjectResourceWizard.updatePerspective(fConfigElement); >+ selectAndReveal(newProject); >+ return true; >+ } >+ >+ protected boolean setCreated() throws CoreException { >+ ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); >+ >+ ICProjectDescription des = mngr.getProjectDescription(newProject, false); >+ >+ if(des == null ) { >+ return false; >+ } >+ >+ if(des.isCdtProjectCreating()){ >+ des = mngr.getProjectDescription(newProject, true); >+ des.setCdtProjectCreated(); >+ mngr.setProjectDescription(newProject, des, false, null); >+ return true; >+ } >+ return false; >+ } >+ >+ @Override >+ public boolean performCancel() { >+ clearProject(); >+ return true; >+ } >+ >+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { >+ fConfigElement= config; >+ } >+ >+ private IRunnableWithProgress getRunnable(boolean _defaults, final boolean onFinish) { >+ final boolean defaults = _defaults; >+ return new IRunnableWithProgress() { >+ public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException { >+ final Exception except[] = new Exception[1]; >+ getShell().getDisplay().syncExec(new Runnable() { >+ public void run() { >+ IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >+ final IProgressMonitor fMonitor; >+ if (monitor == null) { >+ fMonitor= new NullProgressMonitor(); >+ } else { >+ fMonitor = monitor; >+ } >+ fMonitor.beginTask(CUIPlugin.getResourceString("CProjectWizard.op_description"), 100); //$NON-NLS-1$ >+ fMonitor.worked(10); >+ try { >+ newProject = createIProject(lastProjectName, lastProjectLocation, new SubProgressMonitor(fMonitor, 40)); >+ if (newProject != null) >+ fMainPage.h_selected.createProject(newProject, defaults, onFinish, new SubProgressMonitor(fMonitor, 40)); >+ fMonitor.worked(10); >+ } catch (CoreException e) { CUIPlugin.log(e); } >+ finally { >+ fMonitor.done(); >+ } >+ } >+ }); >+ try { >+ getContainer().run(false, true, op); >+ } catch (InvocationTargetException e) { >+ except[0] = e; >+ } catch (InterruptedException e) { >+ except[0] = e; >+ } >+ } >+ }); >+ if (except[0] != null) { >+ if (except[0] instanceof InvocationTargetException) { >+ throw (InvocationTargetException)except[0]; >+ } >+ if (except[0] instanceof InterruptedException) { >+ throw (InterruptedException)except[0]; >+ } >+ throw new InvocationTargetException(except[0]); >+ } >+ } >+ }; >+ } >+ >+ public IProject createIProject(final String name, final URI location) throws CoreException{ >+ return createIProject(name, location, new NullProgressMonitor()); >+ } >+ >+ /** >+ * @since 5.1 >+ */ >+ protected IProgressMonitor continueCreationMonitor; >+ >+ /** >+ * @param monitor >+ * @since 5.1 >+ * >+ */ >+ public IProject createIProject(final String name, final URI location, IProgressMonitor monitor) throws CoreException{ >+ >+ monitor.beginTask(UIMessages.getString("CDTCommonProjectWizard.creatingProject"), 100); //$NON-NLS-1$ >+ >+ if (newProject != null) return newProject; >+ >+ IWorkspace workspace = ResourcesPlugin.getWorkspace(); >+ IWorkspaceRoot root = workspace.getRoot(); >+ final IProject newProjectHandle = root.getProject(name); >+ >+ if (!newProjectHandle.exists()) { >+// IWorkspaceDescription workspaceDesc = workspace.getDescription(); >+// workspaceDesc.setAutoBuilding(false); >+// workspace.setDescription(workspaceDesc); >+ IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName()); >+ if(location != null) >+ description.setLocationURI(location); >+ newProject = CCorePlugin.getDefault().createCDTProject(description, newProjectHandle, new SubProgressMonitor(monitor,25)); >+ } else { >+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() { >+ public void run(IProgressMonitor monitor) throws CoreException { >+ newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor); >+ } >+ }; >+ workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, new SubProgressMonitor(monitor,25)); >+ newProject = newProjectHandle; >+ } >+ >+ // Open the project if we have to >+ if (!newProject.isOpen()) { >+ newProject.open(new SubProgressMonitor(monitor,25)); >+ } >+ >+ continueCreationMonitor = new SubProgressMonitor(monitor,25); >+ IProject proj = continueCreation(newProject); >+ >+ monitor.done(); >+ >+ return proj; >+ } >+ >+ protected abstract IProject continueCreation(IProject prj); >+ public abstract String[] getNatures(); >+ >+ @Override >+ public void dispose() { >+ fMainPage.dispose(); >+ } >+ >+ @Override >+ public boolean canFinish() { >+ if (fMainPage.h_selected != null) { >+ if(!fMainPage.h_selected.canFinish()) >+ return false; >+ String s = fMainPage.h_selected.getErrorMessage(); >+ if (s != null) return false; >+ } >+ return super.canFinish(); >+ } >+ /** >+ * Returns last project name used for creation >+ */ >+ public String getLastProjectName() { >+ return lastProjectName; >+ } >+ >+ public URI getLastProjectLocation() { >+ return lastProjectLocation; >+ } >+ >+ public IProject getLastProject() { >+ return newProject; >+ } >+ >+ // Methods below should provide data for language check >+ public String[] getLanguageIDs (){ >+ String[] contentTypeIds = getContentTypeIDs(); >+ if(contentTypeIds.length > 0) { >+ IContentTypeManager manager = Platform.getContentTypeManager(); >+ List<String> languageIDs = new ArrayList<String>(); >+ for(int i = 0; i < contentTypeIds.length; ++i) { >+ IContentType contentType = manager.getContentType(contentTypeIds[i]); >+ if(null != contentType) { >+ ILanguage language = LanguageManager.getInstance().getLanguage(contentType); >+ if(!languageIDs.contains(language.getId())) { >+ languageIDs.add(language.getId()); >+ } >+ } >+ } >+ return languageIDs.toArray(new String[languageIDs.size()]); >+ } >+ return EMPTY_ARR; >+ } >+ >+ public String[] getContentTypeIDs (){ >+ return EMPTY_ARR; >+ } >+ >+ public String[] getExtensions (){ >+ String[] contentTypeIds = getContentTypeIDs(); >+ if(contentTypeIds.length > 0) { >+ IContentTypeManager manager = Platform.getContentTypeManager(); >+ List<String> extensions = new ArrayList<String>(); >+ for(int i = 0; i < contentTypeIds.length; ++i) { >+ IContentType contentType = manager.getContentType(contentTypeIds[i]); >+ if(null != contentType) { >+ String[] thisTypeExtensions = contentType.getFileSpecs(IContentType.FILE_EXTENSION_SPEC); >+ extensions.addAll(Arrays.asList(thisTypeExtensions)); >+ } >+ } >+ return extensions.toArray(new String[extensions.size()]); >+ } >+ return EMPTY_ARR; >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectConfigurationWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectConfigurationWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectConfigurationWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectConfigurationWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.ptp.rdt.ui.newserviceproviders.RemoteProjectServiceProvider; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+ >+/** >+ * Allows the user to select a remote project location. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ */ >+public class RemoteProjectConfigurationWizardPage extends RemoteServicesConfigurationWizardPage { >+ public RemoteProjectConfigurationWizardPage(RemoteProjectServiceProvider provider, String pageName) { >+ super(provider, pageName); >+ setTitle(pageName); >+ setDescription("This page allows you to choose a remote (or local) provider for your project source files"); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.ui.wizards.RemoteServicesConfigurationWizardPage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ @Override >+ public void createControl(Composite parent) { >+ Composite container = new Composite(parent, SWT.NONE); >+ >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 1; >+ container.setLayout(layout); >+ >+ Label label1 = new Label(container, SWT.LEFT); >+ label1.setText("Choose a provider and a connection to access your source files."); //$NON-NLS-1$ >+ GridData data1 = new GridData(SWT.FILL, SWT.FILL, true, false); >+ label1.setLayoutData(data1); >+ >+ super.createControl(container); >+ >+ setControl(container); >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectLocationContributor.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectLocationContributor.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectLocationContributor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectLocationContributor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,63 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.jface.wizard.IWizardPage; >+import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.ptp.rdt.ui.newserviceproviders.RemoteProjectServiceProvider; >+import org.eclipse.ptp.services.core.IServiceProvider; >+import org.eclipse.ptp.services.ui.IServiceProviderContributor; >+import org.eclipse.ptp.services.ui.wizards.ServiceProviderConfigurationWizard; >+import org.eclipse.swt.widgets.Shell; >+ >+/** >+ * Allows the user to configure a remote project location. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ */ >+public class RemoteProjectLocationContributor implements IServiceProviderContributor { >+ >+ public RemoteProjectLocationContributor() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.IServiceProviderContributor#configureServiceProvider(org.eclipse.ptp.services.core.IServiceProvider, org.eclipse.swt.widgets.Shell) >+ */ >+ public void configureServiceProvider(IServiceProvider provider, Shell parentShell) { >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.IServiceProviderContributor#getWizard(org.eclipse.ptp.services.core.IServiceProvider, org.eclipse.jface.wizard.IWizardPage) >+ */ >+ public IWizard getWizard(IServiceProvider provider, IWizardPage page) { >+ return new ServiceProviderConfigurationWizard(provider, page); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.IServiceProviderContributor#getWizardPages(org.eclipse.ptp.services.core.IServiceProvider) >+ */ >+ public WizardPage[] getWizardPages(IServiceProvider provider) { >+ if (!(provider instanceof RemoteProjectServiceProvider)) { >+ return new WizardPage[0]; >+ } >+ return new WizardPage[]{ >+ new RemoteProjectConfigurationWizardPage((RemoteProjectServiceProvider)provider, "Remote Project Location"), //$NON-NLS-1$ >+ new RemoteProjectDirectoryWizardPage("Project Directory") //$NON-NLS-1$ >+ }; >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/BuildServiceWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/BuildServiceWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/BuildServiceWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/BuildServiceWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,59 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.ptp.services.core.IService; >+import org.eclipse.ptp.services.ui.wizards.ServiceConfigurationWizardPage; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+ >+/** >+ * Allows the user to select a remote or local project configuration. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * >+ */ >+public class BuildServiceWizardPage extends ServiceConfigurationWizardPage { >+ public BuildServiceWizardPage(IService service, String pageName) { >+ super(service, pageName); >+ setTitle(pageName); >+ setDescription("This page allows you to set the location where your project will be built."); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.wizards.ServiceConfigurationWizardPage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ @Override >+ public void createControl(Composite parent) { >+ Composite container = new Composite(parent, SWT.NONE); >+ >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 1; >+ container.setLayout(layout); >+ >+ Label label = new Label(container, SWT.LEFT); >+ label.setText("Choose a provider that most closely matches where your project will be built."); //$NON-NLS-1$ >+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); >+ label.setLayoutData(data); >+ >+ super.createControl(container); >+ >+ setControl(container); >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/ConfigureRemoteServices.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/ConfigureRemoteServices.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/ConfigureRemoteServices.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/ConfigureRemoteServices.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,76 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import java.io.IOException; >+import java.util.Properties; >+ >+import org.eclipse.cdt.core.CCorePlugin; >+import org.eclipse.cdt.core.model.ICProject; >+import org.eclipse.cdt.internal.core.model.CModelManager; >+import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.ptp.internal.rdt.core.index.RemoteFastIndexer; >+import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.services.core.IServiceConfiguration; >+import org.eclipse.ptp.services.core.ServiceModelManager; >+import org.eclipse.rse.internal.connectorservice.dstore.Activator; >+ >+/** >+ * Configure remote services for a project with the available services and service providers >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author vkong >+ * >+ */ >+public class ConfigureRemoteServices { >+ >+ public static String DEFAULT_CONFIG = Messages.getString("ConfigureRemoteServices.0"); //$NON-NLS-1$ >+ >+ /** >+ * @throws NullPointerException if any of the parameters are null >+ */ >+ public static void configure(IProject project, IServiceConfiguration config, IProgressMonitor monitor) { >+ >+ monitor.beginTask("actual Configure remote services", 100); //$NON-NLS-1$ >+ >+ if(project == null || config == null) { >+ throw new NullPointerException(); >+ } >+ >+ final ServiceModelManager serviceModelManager = ServiceModelManager.getInstance(); >+ >+ //have to set it as active >+ serviceModelManager.setConfiguration(project, config); >+ serviceModelManager.setActiveConfiguration(project, config); >+ monitor.worked(10); >+ >+ try { >+ serviceModelManager.saveModelConfiguration(); >+ } catch (IOException e) { >+ Activator.logError(e.toString(), e); >+ } >+ monitor.worked(80); >+ >+ ICProject cProject = CModelManager.getDefault().getCModel().getCProject(project); >+ CCorePlugin.getIndexManager().setIndexerId(cProject, RemoteFastIndexer.ID); >+ Properties properties = new Properties(); >+ properties.put(IndexerPreferences.KEY_FILES_TO_PARSE_UP_FRONT, ""); //$NON-NLS-1$ >+ IndexerPreferences.setProperties(project, IndexerPreferences.SCOPE_PROJECT_PRIVATE, properties); >+ monitor.worked(10); >+ monitor.done(); >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalCIndexServiceProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalCIndexServiceProvider.java >diff -N src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalCIndexServiceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalCIndexServiceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,290 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newserviceproviders; >+ >+import java.util.Collections; >+import java.util.List; >+import java.util.Set; >+ >+import org.eclipse.cdt.core.model.ICElement; >+import org.eclipse.cdt.core.model.ICProject; >+import org.eclipse.cdt.core.model.ISourceReference; >+import org.eclipse.cdt.core.model.ITranslationUnit; >+import org.eclipse.cdt.core.model.IWorkingCopy; >+import org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.jface.text.ITextSelection; >+import org.eclipse.ptp.internal.rdt.core.callhierarchy.CalledByResult; >+import org.eclipse.ptp.internal.rdt.core.callhierarchy.CallsToResult; >+import org.eclipse.ptp.internal.rdt.core.callhierarchy.ICallHierarchyService; >+import org.eclipse.ptp.internal.rdt.core.contentassist.Proposal; >+import org.eclipse.ptp.internal.rdt.core.index.IIndexLifecycleService; >+import org.eclipse.ptp.internal.rdt.core.index.RemoteIndexerTask; >+import org.eclipse.ptp.internal.rdt.core.model.Scope; >+import org.eclipse.ptp.internal.rdt.core.navigation.INavigationService; >+import org.eclipse.ptp.internal.rdt.core.navigation.OpenDeclarationResult; >+import org.eclipse.ptp.internal.rdt.core.typehierarchy.ITypeHierarchyService; >+import org.eclipse.ptp.internal.rdt.core.typehierarchy.THGraph; >+import org.eclipse.ptp.internal.rdt.ui.contentassist.IContentAssistService; >+import org.eclipse.ptp.internal.rdt.ui.search.ISearchService; >+import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.rdt.ui.serviceproviders.IIndexServiceProvider2; >+import org.eclipse.rse.core.model.IHost; >+import org.eclipse.search.ui.ISearchQuery; >+import org.eclipse.search.ui.ISearchResult; >+import org.eclipse.search.ui.ISearchResultListener; >+ >+/** >+ * A C/C++ indexing service provider that does nothing. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author vkong >+ * @author crecoskie >+ * >+ */ >+public class LocalCIndexServiceProvider extends >+ AbstractRemoteCIndexServiceProvider implements IIndexServiceProvider2 { >+ >+ private final class NullSearchQuery implements ISearchQuery { >+ >+ private final class NullSearchResult implements ISearchResult { >+ private ISearchQuery fQuery = null; >+ >+ public NullSearchResult(ISearchQuery query) { >+ fQuery = query; >+ } >+ >+ public void addListener(ISearchResultListener l) { >+ // do nothing >+ } >+ >+ public ImageDescriptor getImageDescriptor() { >+ // no image >+ return null; >+ } >+ >+ public String getLabel() { >+ return Messages.getString("LocalCIndexServiceProvider.1"); //$NON-NLS-1$ >+ } >+ >+ public ISearchQuery getQuery() { >+ return fQuery; >+ } >+ >+ public String getTooltip() { >+ return null; >+ } >+ >+ public void removeListener(ISearchResultListener l) { >+ // do nothing >+ } >+ } >+ >+ public boolean canRerun() { >+ return false; >+ } >+ >+ public boolean canRunInBackground() { >+ return true; >+ } >+ >+ public String getLabel() { >+ return Messages.getString("LocalCIndexServiceProvider.0"); //$NON-NLS-1$ >+ } >+ >+ public ISearchResult getSearchResult() { >+ return new NullSearchResult(this); >+ } >+ >+ public IStatus run(IProgressMonitor monitor) throws OperationCanceledException { >+ return Status.OK_STATUS; >+ } >+ } >+ >+ public static final String ID = "org.eclipse.ptp.rdt.ui.LocalCIndexServiceProvider"; //$NON-NLS-1$ >+ public static final String SERVICE_ID = "org.eclipse.ptp.rdt.core.CIndexingService"; //$NON-NLS-1$ >+ >+ public LocalCIndexServiceProvider() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.serviceproviders.AbstractRemoteCIndexServiceProvider#getCallHierarchyService() >+ */ >+ @Override >+ public ICallHierarchyService getCallHierarchyService() { >+ return new ICallHierarchyService () { >+ >+ public CalledByResult findCalledBy(Scope scope, ICElement callee, IProgressMonitor pm) throws CoreException, >+ InterruptedException { >+ return new CalledByResult(); >+ } >+ >+ public CallsToResult findCalls(Scope scope, ICElement caller, IProgressMonitor pm) throws CoreException, >+ InterruptedException { >+ return new CallsToResult(); >+ } >+ >+ public ICElement[] findDefinitions(Scope scope, ICElement input, IProgressMonitor pm) { >+ return new ICElement[0]; >+ } >+ >+ public ICElement[] findDefinitions(Scope scope, ICProject project, IWorkingCopy workingCopy, int selectionStart, >+ int selectionLength, IProgressMonitor pm) throws CoreException { >+ return new ICElement[0]; >+ } >+ >+ }; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.serviceproviders.AbstractRemoteCIndexServiceProvider#getHost() >+ */ >+ @Override >+ public IHost getHost() { >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.serviceproviders.AbstractRemoteCIndexServiceProvider#getIndexLifeCycleService() >+ */ >+ @Override >+ public synchronized IIndexLifecycleService getIndexLifeCycleService() { >+ return new IIndexLifecycleService () { >+ >+ public Scope createScope(String name, List<ICElement> elements, IProgressMonitor monitor) { >+ return null; >+ } >+ >+ public Scope getScope(String name) { >+ return null; >+ } >+ >+ public Set<Scope> getScopes() { >+ return Collections.emptySet(); >+ } >+ >+ public void reindex(Scope scope, List<ICElement> elements, IProgressMonitor monitor, RemoteIndexerTask task) { >+ // do nothing >+ >+ } >+ >+ public void reindex(Scope scope, IProgressMonitor monitor, RemoteIndexerTask task) { >+ // do nothing >+ >+ } >+ >+ public void update(Scope scope, List<ICElement> asList, >+ List<ICElement> asList2, List<ICElement> asList3, >+ IProgressMonitor monitor, RemoteIndexerTask task) { >+ // do nothing >+ >+ } >+ >+ }; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.serviceproviders.AbstractRemoteCIndexServiceProvider#getNavigationService() >+ */ >+ @Override >+ public INavigationService getNavigationService() { >+ return new INavigationService() { >+ >+ public OpenDeclarationResult openDeclaration(Scope scope, >+ ITranslationUnit workingCopy, String selectedText, >+ int selectionStart, int selectionLength, >+ IProgressMonitor monitor) { >+ >+ return null; >+ } >+ >+ }; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.serviceproviders.AbstractRemoteCIndexServiceProvider#getTypeHierarchyService() >+ */ >+ @Override >+ public ITypeHierarchyService getTypeHierarchyService() { >+ return new ITypeHierarchyService () { >+ >+ public THGraph computeGraph(Scope scope, ICElement input, IProgressMonitor monitor) throws CoreException, >+ InterruptedException { >+ return new THGraph(); >+ } >+ >+ public ICElement[] findInput(Scope scope, ICElement memberInput, IProgressMonitor monitor) { >+ return new ICElement[0]; >+ } >+ >+ public ICElement[] findInput(Scope scope, ICProject project, IWorkingCopy workingCopy, int selectionStart, >+ int selectionLength, IProgressMonitor monitor) throws CoreException { >+ return new ICElement[0]; >+ } >+ >+ }; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.ui.serviceproviders.IIndexServiceProvider2#getContentAssistService() >+ */ >+ public IContentAssistService getContentAssistService() { >+ return new IContentAssistService() { >+ >+ public List<Proposal> computeCompletionProposals(Scope scope, ContentAssistInvocationContext context, >+ ITranslationUnit unit) { >+ return Collections.emptyList(); >+ } >+ >+ }; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.ui.serviceproviders.IIndexServiceProvider2#getSearchService() >+ */ >+ public ISearchService getSearchService() { >+ return new ISearchService () { >+ >+ public ISearchQuery createSearchElementQuery(Scope indexScope, ICElement[] searchScope, ISourceReference object, >+ int limitTo) { >+ return new NullSearchQuery(); >+ } >+ >+ public ISearchQuery createSearchPatternQuery(Scope indexScope, ICElement[] searchScope, String scopeDescription, >+ String patternStr, boolean isCaseSensitive, int searchFlags) { >+ return new NullSearchQuery(); >+ } >+ >+ public ISearchQuery createSearchTextSelectionQuery(Scope indexScope, ICElement[] searchScope, >+ ITranslationUnit element, ITextSelection selNode, int limitTo) { >+ return new NullSearchQuery(); >+ } >+ >+ }; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.serviceproviders.AbstractRemoteCIndexServiceProvider#isConfigured() >+ */ >+ @Override >+ public boolean isConfigured() { >+ return true; >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteServicesServiceProviderConfigurer.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteServicesServiceProviderConfigurer.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteServicesServiceProviderConfigurer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteServicesServiceProviderConfigurer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,63 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.jface.wizard.IWizardPage; >+import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.ptp.rdt.ui.newserviceproviders.RemoteBuildServiceProvider; >+import org.eclipse.ptp.services.core.IServiceProvider; >+import org.eclipse.ptp.services.ui.IServiceProviderContributor; >+import org.eclipse.ptp.services.ui.wizards.ServiceProviderConfigurationWizard; >+import org.eclipse.swt.widgets.Shell; >+ >+/** >+ * Allows the user to select a provider of Remote Services for a RemoteBuildServiceProvider. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * @see org.eclipse.ptp.rdt.ui.serviceproviders.RemoteBuildServiceProvider >+ * >+ */ >+public class RemoteServicesServiceProviderConfigurer implements IServiceProviderContributor { >+ >+ public RemoteServicesServiceProviderConfigurer() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.services.ui.IServiceProviderConfiguration#configureServiceProvider(org.eclipse.ptp.rdt.services.core.IServiceProvider, org.eclipse.swt.widgets.Shell) >+ */ >+ public void configureServiceProvider(IServiceProvider provider, Shell parentShell) { >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.IServiceProviderContributor#getWizard(org.eclipse.ptp.services.core.IServiceProvider, org.eclipse.jface.wizard.IWizardPage) >+ */ >+ public IWizard getWizard(IServiceProvider provider, IWizardPage page) { >+ return new ServiceProviderConfigurationWizard(provider, page); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.IServiceProviderContributor#getWizardPages(org.eclipse.ptp.services.core.IServiceProvider) >+ */ >+ public WizardPage[] getWizardPages(IServiceProvider provider) { >+ if (!(provider instanceof RemoteBuildServiceProvider)) { >+ return new WizardPage[0]; >+ } >+ return new WizardPage[]{new RemoteServicesConfigurationWizardPage((RemoteBuildServiceProvider)provider, "Remote Build Services Configuration")}; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteProjectServiceProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteProjectServiceProvider.java >diff -N src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteProjectServiceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteProjectServiceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newserviceproviders; >+ >+ >+/** >+ * A project location service provider that is remote. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ */ >+public class RemoteProjectServiceProvider extends AbstractRemoteServicesProvider { >+ public final static String ID = "org.eclipse.ptp.rdt.ui.RemoteProjectLocationProvider"; //$NON-NLS-1$ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/NewRemoteProjectWizard.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/NewRemoteProjectWizard.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/NewRemoteProjectWizard.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/NewRemoteProjectWizard.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,75 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.cdt.core.CCProjectNature; >+import org.eclipse.cdt.core.CProjectNature; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.ptp.internal.rdt.ui.RDTPluginImages; >+import org.eclipse.ptp.rdt.core.resources.RemoteNature; >+ >+/** >+ * A wizard for creating new Remote C/C++ Projects >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * >+ */ >+public class NewRemoteProjectWizard extends RemoteCommonProjectWizard { >+ private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$ >+ private static final String wz_title = "New Remote Project"; //$NON-NLS-1$ >+ private static final String wz_desc = "Create remote project of the selected type"; //$NON-NLS-1$ >+ >+ /** >+ * >+ */ >+ public NewRemoteProjectWizard() { >+ super(wz_title, wz_desc); >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard#continueCreation(org.eclipse.core.resources.IProject) >+ */ >+ >+ @Override >+ protected IProject continueCreation(IProject prj) { >+ try { >+ CProjectNature.addCNature(prj, new NullProgressMonitor()); >+ CCProjectNature.addCCNature(prj, new NullProgressMonitor()); >+ RemoteNature.addRemoteNature(prj, new NullProgressMonitor()); >+ } catch (CoreException e) {} >+ return prj; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard#getNatures() >+ */ >+ @Override >+ public String[] getNatures() { >+ return new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID, RemoteNature.REMOTE_NATURE_ID}; >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.wizards.newresource.BasicNewResourceWizard#initializeDefaultPageImageDescriptor() >+ */ >+ @Override >+ protected void initializeDefaultPageImageDescriptor() { >+ setDefaultPageImageDescriptor(RDTPluginImages.DESC_WIZBAN_NEW_REMOTE_C_PROJ); >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/CIndexingServiceContributor.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/CIndexingServiceContributor.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/CIndexingServiceContributor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/CIndexingServiceContributor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.ptp.services.core.IService; >+import org.eclipse.ptp.services.ui.IServiceContributor; >+ >+/** >+ * Allows the user to configure a project location. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ */ >+public class CIndexingServiceContributor implements IServiceContributor { >+ >+ public CIndexingServiceContributor() { >+ } >+ >+ public WizardPage[] getWizardPages(IService service) { >+ return new WizardPage[]{ >+ new CIndexingServiceWizardPage(service, "C/C++ Indexing Service Configuration") //$NON-NLS-1$ >+ }; >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/BuildServiceContributor.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/BuildServiceContributor.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/BuildServiceContributor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/BuildServiceContributor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.ptp.services.core.IService; >+import org.eclipse.ptp.services.ui.IServiceContributor; >+ >+/** >+ * Allows the user to configure a project location. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ */ >+public class BuildServiceContributor implements IServiceContributor { >+ >+ public BuildServiceContributor() { >+ } >+ >+ public WizardPage[] getWizardPages(IService service) { >+ return new WizardPage[]{ >+ new BuildServiceWizardPage(service, "Build Service Configuration") //$NON-NLS-1$ >+ }; >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newserviceproviders/AbstractRemoteCIndexServiceProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newserviceproviders/AbstractRemoteCIndexServiceProvider.java >diff -N src/org/eclipse/ptp/rdt/ui/newserviceproviders/AbstractRemoteCIndexServiceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newserviceproviders/AbstractRemoteCIndexServiceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,125 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newserviceproviders; >+ >+import org.eclipse.ptp.internal.rdt.core.callhierarchy.ICallHierarchyService; >+import org.eclipse.ptp.internal.rdt.core.callhierarchy.RemoteCallHierarchyService; >+import org.eclipse.ptp.internal.rdt.core.includebrowser.IIncludeBrowserService; >+import org.eclipse.ptp.internal.rdt.core.includebrowser.RemoteIncludeBrowserService; >+import org.eclipse.ptp.internal.rdt.core.index.IIndexLifecycleService; >+import org.eclipse.ptp.internal.rdt.core.index.RemoteIndexLifecycleService; >+import org.eclipse.ptp.internal.rdt.core.navigation.INavigationService; >+import org.eclipse.ptp.internal.rdt.core.navigation.RemoteNavigationService; >+import org.eclipse.ptp.internal.rdt.core.typehierarchy.ITypeHierarchyService; >+import org.eclipse.ptp.internal.rdt.core.typehierarchy.RemoteTypeHierarchyService; >+import org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider; >+import org.eclipse.rse.core.model.IHost; >+import org.eclipse.rse.core.subsystems.IConnectorService; >+ >+/** >+ * Abstract class which forms the basis of a remote C/C++ indexing provider. >+ * >+ * @author crecoskie >+ * @noextend >+ * @see org.eclipse.ptp.rdt.ui.serviceproviders.RemoteCIndexServiceProvider >+ */ >+public abstract class AbstractRemoteCIndexServiceProvider extends AbstractRemoteServicesProvider implements IIndexServiceProvider { >+ private static final String HOST_NAME_KEY = "host-name"; //$NON-NLS-1$ >+ >+ protected boolean fIsConfigured; >+ protected IHost fHost; >+ protected IConnectorService fConnectorService; >+ protected IIndexLifecycleService fIndexLifecycleService; >+ protected INavigationService fNavigationService; >+ protected ICallHierarchyService fCallHierarchyService; >+ protected ITypeHierarchyService fTypeHierarchyService; >+ protected IIncludeBrowserService fIncludeBrowserService; >+ >+ public AbstractRemoteCIndexServiceProvider() { >+ } >+ >+ public String getHostName() { >+ return getString(HOST_NAME_KEY); >+ } >+ >+ public void setConnection(IHost host, IConnectorService connectorService) { >+ fHost = host; >+ fConnectorService = connectorService; >+ putString(HOST_NAME_KEY, host.getAliasName()); >+ setConfigured(true); >+ } >+ >+ public boolean isConfigured() { >+ return fIsConfigured; >+ } >+ >+ public void setConfigured(boolean isConfigured) { >+ fIsConfigured = isConfigured; >+ } >+ >+ public synchronized IIndexLifecycleService getIndexLifeCycleService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fIndexLifecycleService == null) >+ fIndexLifecycleService = new RemoteIndexLifecycleService(fHost, fConnectorService); >+ >+ return fIndexLifecycleService; >+ } >+ >+ public synchronized INavigationService getNavigationService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fNavigationService== null) >+ fNavigationService = new RemoteNavigationService(fHost, fConnectorService); >+ >+ return fNavigationService; >+ } >+ >+ public synchronized ICallHierarchyService getCallHierarchyService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fCallHierarchyService== null) >+ fCallHierarchyService = new RemoteCallHierarchyService(fHost, fConnectorService); >+ >+ return fCallHierarchyService; >+ } >+ >+ public synchronized ITypeHierarchyService getTypeHierarchyService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fTypeHierarchyService== null) >+ fTypeHierarchyService = new RemoteTypeHierarchyService(fHost, fConnectorService); >+ >+ return fTypeHierarchyService; >+ } >+ >+ public synchronized IIncludeBrowserService getIncludeBrowserService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fIncludeBrowserService== null) >+ fIncludeBrowserService = new RemoteIncludeBrowserService(fHost, fConnectorService); >+ >+ return fIncludeBrowserService; >+ } >+ >+ /** >+ * @return the system connection for this service provider >+ */ >+ public IHost getHost() { >+ return fHost; >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectDirectoryWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectDirectoryWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectDirectoryWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectDirectoryWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,73 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.ptp.services.ui.wizards.ServiceProviderConfigurationWizardPage; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+ >+/** >+ * Allows the user to select a remote project location. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ */ >+public class RemoteProjectDirectoryWizardPage extends ServiceProviderConfigurationWizardPage { >+ public RemoteProjectDirectoryWizardPage(String pageName) { >+ super(pageName); >+ setTitle(pageName); >+ setDescription("This page allows you to choose the directory for your project source files"); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.ui.wizards.RemoteServicesConfigurationWizardPage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ @Override >+ public void createControl(Composite parent) { >+ Composite container = new Composite(parent, SWT.NONE); >+ >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 3; >+ container.setLayout(layout); >+ setControl(container); >+ >+ Label label1 = new Label(container, SWT.LEFT); >+ label1.setText("Choose a directory for your project."); //$NON-NLS-1$ >+ GridData data1 = new GridData(SWT.FILL, SWT.FILL, true, false); >+ data1.horizontalSpan = 3; >+ label1.setLayoutData(data1); >+ >+ Label label2 = new Label(container, SWT.NONE); >+ label2.setText("Directory:"); //$NON-NLS-1$ >+ GridData gd = new GridData(); >+ gd.horizontalSpan = 1; >+ label2.setLayoutData(gd); >+ >+ Text text = new Text(container, SWT.SINGLE | SWT.BORDER); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = 1; >+ gd.grabExcessHorizontalSpace = true; >+ gd.widthHint = 100; >+ text.setLayoutData(gd); >+ >+ Button browseButton = new Button(container, SWT.PUSH); >+ browseButton.setText("Browse..."); //$NON-NLS-1$ >+ >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/NewRemoteProjectCreationPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/NewRemoteProjectCreationPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/NewRemoteProjectCreationPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/NewRemoteProjectCreationPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,354 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2009 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * Jakub Jurkiewicz <jakub.jurkiewicz@gmail.com> - Fix for Bug 174737 >+ * [IDE] New Plug-in Project wizard status handling is inconsistent >+ * Oakland Software Incorporated (Francis Upton) <francisu@ieee.org> >+ * Bug 224997 [Workbench] Impossible to copy project >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import java.net.URI; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IWorkspace; >+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.jface.dialogs.Dialog; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.ptp.rdt.ui.newwizards.RemoteProjectContentsLocationArea.IErrorMessageReporter; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Listener; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; >+import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; >+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; >+import org.eclipse.ui.internal.ide.IIDEHelpContextIds; >+ >+/** >+ * Standard main page for a wizard that is creates a project resource. >+ * <p> >+ * This page may be used by clients as-is; it may be also be subclassed to suit. >+ * </p> >+ * <p> >+ * Example usage: >+ * <pre> >+ * mainPage = new NewRemoteProjectCreationPage("basicNewProjectPage"); >+ * mainPage.setTitle("Project"); >+ * mainPage.setDescription("Create a new project resource."); >+ * </pre> >+ * </p> >+ */ >+public class NewRemoteProjectCreationPage extends WizardNewProjectCreationPage { >+ >+ // initial value stores >+ private String initialProjectFieldValue; >+ >+ // widgets >+ private Text projectNameField; >+ >+ private Listener nameModifyListener = new Listener() { >+ public void handleEvent(Event e) { >+ setLocationForSelection(); >+ boolean valid = validatePage(); >+ setPageComplete(valid); >+ >+ } >+ }; >+ >+ private RemoteProjectContentsLocationArea locationArea; >+ >+// private WorkingSetGroup workingSetGroup; >+ >+ // constants >+ private static final int SIZING_TEXT_FIELD_WIDTH = 250; >+ >+ /** >+ * Creates a new project creation wizard page. >+ * >+ * @param pageName the name of this page >+ */ >+ public NewRemoteProjectCreationPage(String pageName) { >+ super(pageName); >+ setPageComplete(false); >+ } >+ >+ /** >+ * Creates a new project creation wizard page. >+ * >+ * @param pageName >+ * @param selection >+ * @param workingSetTypes >+ * >+ * @deprecated default placement of the working set group has been removed. >+ * If you wish to use the working set block please call >+ * {@link #createWorkingSetGroup(Composite, IStructuredSelection, String[])} >+ * in your overridden {@link #createControl(Composite)} >+ * implementation. >+ * @since 3.4 >+ */ >+ public NewRemoteProjectCreationPage(String pageName, >+ IStructuredSelection selection, String[] workingSetTypes) { >+ this(pageName); >+ } >+ >+ /** (non-Javadoc) >+ * Method declared on IDialogPage. >+ */ >+ public void createControl(Composite parent) { >+ Composite composite = new Composite(parent, SWT.NULL); >+ >+ initializeDialogUnits(parent); >+ >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, >+ IIDEHelpContextIds.NEW_PROJECT_WIZARD_PAGE); >+ >+ composite.setLayout(new GridLayout()); >+ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ >+ createProjectNameGroup(composite); >+ locationArea = new RemoteProjectContentsLocationArea(getErrorReporter(), composite); >+ if(initialProjectFieldValue != null) { >+ locationArea.updateProjectName(initialProjectFieldValue); >+ } >+ >+ // Scale the buttons based on the rest of the dialog >+ for (Button button : locationArea.getButtons()) { >+ setButtonLayoutData(button); >+ } >+ >+ setPageComplete(validatePage()); >+ // Show description on opening >+ setErrorMessage(null); >+ setMessage(null); >+ setControl(composite); >+ Dialog.applyDialogFont(composite); >+ } >+ >+ /** >+ * Get an error reporter for the receiver. >+ * @return IErrorMessageReporter >+ */ >+ private IErrorMessageReporter getErrorReporter() { >+ return new IErrorMessageReporter(){ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea.IErrorMessageReporter#reportError(java.lang.String) >+ */ >+ public void reportError(String errorMessage, boolean infoOnly) { >+ if (infoOnly) { >+ setMessage(errorMessage, IStatus.INFO); >+ setErrorMessage(null); >+ } >+ else >+ setErrorMessage(errorMessage); >+ boolean valid = errorMessage == null; >+ if(valid) { >+ valid = validatePage(); >+ } >+ >+ setPageComplete(valid); >+ } >+ }; >+ } >+ >+ /** >+ * Creates the project name specification controls. >+ * >+ * @param parent the parent composite >+ */ >+ private final void createProjectNameGroup(Composite parent) { >+ // project specification group >+ Composite projectGroup = new Composite(parent, SWT.NONE); >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 2; >+ projectGroup.setLayout(layout); >+ projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ >+ // new project label >+ Label projectLabel = new Label(projectGroup, SWT.NONE); >+ projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel); >+ projectLabel.setFont(parent.getFont()); >+ >+ // new project name entry field >+ projectNameField = new Text(projectGroup, SWT.BORDER); >+ GridData data = new GridData(GridData.FILL_HORIZONTAL); >+ data.widthHint = SIZING_TEXT_FIELD_WIDTH; >+ projectNameField.setLayoutData(data); >+ projectNameField.setFont(parent.getFont()); >+ >+ // Set the initial value first before listener >+ // to avoid handling an event during the creation. >+ if (initialProjectFieldValue != null) { >+ projectNameField.setText(initialProjectFieldValue); >+ } >+ projectNameField.addListener(SWT.Modify, nameModifyListener); >+ } >+ >+ /** >+ * Returns the current project location path as entered by >+ * the user, or its anticipated initial value. >+ * Note that if the default has been returned the path >+ * in a project description used to create a project >+ * should not be set. >+ * >+ * @return the project location path or its anticipated initial value. >+ */ >+ public IPath getLocationPath() { >+ return new Path(locationArea.getProjectLocation()); >+ } >+ >+ /** >+ * Returns the current project location URI as entered by >+ * the user, or <code>null</code> if a valid project location >+ * has not been entered. >+ * >+ * @return the project location URI, or <code>null</code> >+ * @since 3.2 >+ */ >+ public URI getLocationURI() { >+ return locationArea.getProjectLocationURI(); >+ } >+ >+ /** >+ * Returns the current project name as entered by the user, or its anticipated >+ * initial value. >+ * >+ * @return the project name, its anticipated initial value, or <code>null</code> >+ * if no project name is known >+ */ >+ public String getProjectName() { >+ if (projectNameField == null) { >+ return initialProjectFieldValue; >+ } >+ >+ return getProjectNameFieldValue(); >+ } >+ >+ /** >+ * Returns the value of the project name field >+ * with leading and trailing spaces removed. >+ * >+ * @return the project name in the field >+ */ >+ private String getProjectNameFieldValue() { >+ if (projectNameField == null) { >+ return ""; //$NON-NLS-1$ >+ } >+ >+ return projectNameField.getText().trim(); >+ } >+ >+ /** >+ * Sets the initial project name that this page will use when >+ * created. The name is ignored if the createControl(Composite) >+ * method has already been called. Leading and trailing spaces >+ * in the name are ignored. >+ * Providing the name of an existing project will not necessarily >+ * cause the wizard to warn the user. Callers of this method >+ * should first check if the project name passed already exists >+ * in the workspace. >+ * >+ * @param name initial project name for this page >+ * >+ * @see IWorkspace#validateName(String, int) >+ * >+ */ >+ public void setInitialProjectName(String name) { >+ if (name == null) { >+ initialProjectFieldValue = null; >+ } else { >+ initialProjectFieldValue = name.trim(); >+ if(locationArea != null) { >+ locationArea.updateProjectName(name.trim()); >+ } >+ } >+ } >+ >+ /** >+ * Set the location to the default location if we are set to useDefaults. >+ */ >+ private void setLocationForSelection() { >+ locationArea.updateProjectName(getProjectNameFieldValue()); >+ } >+ >+ >+ /** >+ * Returns whether this page's controls currently all contain valid >+ * values. >+ * >+ * @return <code>true</code> if all controls are valid, and >+ * <code>false</code> if at least one is invalid >+ */ >+ protected boolean validatePage() { >+ IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); >+ >+ String projectFieldContents = getProjectNameFieldValue(); >+ if (projectFieldContents.equals("")) { //$NON-NLS-1$ >+ setErrorMessage(null); >+ setMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectNameEmpty); >+ return false; >+ } >+ >+ IStatus nameStatus = workspace.validateName(projectFieldContents, >+ IResource.PROJECT); >+ if (!nameStatus.isOK()) { >+ setErrorMessage(nameStatus.getMessage()); >+ return false; >+ } >+ >+ IProject handle = getProjectHandle(); >+ if (handle.exists()) { >+ setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage); >+ return false; >+ } >+ >+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( >+ getProjectNameFieldValue()); >+ locationArea.setExistingProject(project); >+ >+ String validLocationMessage = locationArea.checkValidLocation(); >+ if (validLocationMessage != null) { // there is no destination location given >+ setErrorMessage(validLocationMessage); >+ return false; >+ } >+ >+ setErrorMessage(null); >+ setMessage(null); >+ return true; >+ } >+ >+ /* >+ * see @DialogPage.setVisible(boolean) >+ */ >+ public void setVisible(boolean visible) { >+ getControl().setVisible(visible); >+ if (visible) { >+ projectNameField.setFocus(); >+ } >+ } >+ >+ /** >+ * Returns the useDefaults. >+ * @return boolean >+ */ >+ public boolean useDefaults() { >+ return locationArea.isDefault(); >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/ProjectLocationServiceContributor.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/ProjectLocationServiceContributor.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/ProjectLocationServiceContributor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/ProjectLocationServiceContributor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.ptp.services.core.IService; >+import org.eclipse.ptp.services.ui.IServiceContributor; >+ >+/** >+ * Allows the user to configure a project location. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ */ >+public class ProjectLocationServiceContributor implements IServiceContributor { >+ >+ public final static String SERVICE_ID = "org.eclipse.ptp.rdt.core.ProjectLocationService"; //$NON-NLS-1$ >+ >+ public ProjectLocationServiceContributor() { >+ } >+ >+ public WizardPage[] getWizardPages(IService service) { >+ return new WizardPage[]{ >+ new ProjectLocationServiceWizardPage(service, "Project Location Configuration") //$NON-NLS-1$ >+ }; >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteCIndexServiceProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteCIndexServiceProvider.java >diff -N src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteCIndexServiceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteCIndexServiceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,96 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newserviceproviders; >+ >+import org.eclipse.ptp.internal.rdt.ui.contentassist.IContentAssistService; >+import org.eclipse.ptp.internal.rdt.ui.contentassist.RemoteContentAssistService; >+import org.eclipse.ptp.internal.rdt.ui.search.ISearchService; >+import org.eclipse.ptp.internal.rdt.ui.search.RemoteSearchService; >+import org.eclipse.ptp.rdt.ui.serviceproviders.IIndexServiceProvider2; >+import org.eclipse.rse.connectorservice.dstore.DStoreConnectorService; >+import org.eclipse.rse.core.model.IHost; >+import org.eclipse.rse.core.model.SystemStartHere; >+import org.eclipse.rse.core.subsystems.IConnectorService; >+ >+/** >+ * An RSE-based provider of C/C++ indexing services. >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * >+ */ >+public class RemoteCIndexServiceProvider extends AbstractRemoteCIndexServiceProvider implements IIndexServiceProvider2 { >+ >+ public static final String SERVICE_ID = "org.eclipse.ptp.rdt.ui.RemoteCIndexService"; //$NON-NLS-1$ >+ public static final String ID = "org.eclipse.ptp.rdt.ui.RemoteCIndexServiceProvider"; //$NON-NLS-1$ >+ >+ private RemoteSearchService fSearchService; >+ private IContentAssistService fContentAssistService; >+ >+ public RemoteCIndexServiceProvider() { >+ } >+ >+ public synchronized ISearchService getSearchService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fSearchService == null) >+ fSearchService = new RemoteSearchService(fHost, fConnectorService); >+ >+ return fSearchService; >+ } >+ >+ public synchronized IContentAssistService getContentAssistService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fContentAssistService == null) >+ fContentAssistService = new RemoteContentAssistService(fHost, fConnectorService); >+ >+ return fContentAssistService; >+ } >+ >+ @Override >+ public boolean isConfigured() { >+ String hostName = getHostName(); >+ if (fHost == null && hostName != null) { >+ IHost[] hosts = SystemStartHere.getConnections(); >+ for (IHost host : hosts) { >+ if (host.getAliasName().equals(hostName)) { >+ setConnection(host, getDStoreConnectorService(host)); >+ } >+ } >+ } >+ return super.isConfigured(); >+ } >+ >+ public static IConnectorService getDStoreConnectorService(IHost host) { >+ IConnectorService[] connectorServices = host.getConnectorServices(); >+ >+ for(int k = 0; k < connectorServices.length; k++) { >+ if(connectorServices[k] instanceof DStoreConnectorService) >+ return connectorServices[k]; >+ } >+ >+ return null; >+ } >+ >+ public String toString() { >+ String hostName = getHostName(); >+ if (hostName == null) { >+ hostName = "<not_configured>"; //$NON-NLS-1$ >+ } >+ return "RemoteCIndexServiceProvider(" + hostName + ")"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newserviceproviders/IRemoteServiceProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newserviceproviders/IRemoteServiceProvider.java >diff -N src/org/eclipse/ptp/rdt/ui/newserviceproviders/IRemoteServiceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newserviceproviders/IRemoteServiceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newserviceproviders; >+ >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+import org.eclipse.ptp.services.core.IServiceProvider; >+ >+/** >+ * Provides execution services for shell commands over a remote connection, >+ * and remote file manipulation services. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ */ >+public interface IRemoteServiceProvider extends IServiceProvider { >+ >+ /** >+ * Gets the provider of remote services. >+ * >+ * @return IRemoteServices >+ */ >+ public IRemoteServices getRemoteServices(); >+ >+ /** >+ * Gets the connection to use for this service. The connection may not be open, so >+ * clients should check to make sure it is open before using it. >+ * >+ * @return IRemoteConnection >+ */ >+ public IRemoteConnection getConnection(); >+ >+ /** >+ * Sets the connection that this provider should use for its execution services. >+ * >+ * @param connection >+ */ >+ public void setRemoteConnectionName(String name); >+ >+ /** >+ * Sets the ID of the Remote Tools provider that this provider should use for its execution services. >+ * >+ * @param id >+ */ >+ public void setRemoteServicesID(String id); >+} >Index: src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalBuildServiceProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalBuildServiceProvider.java >diff -N src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalBuildServiceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalBuildServiceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,40 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newserviceproviders; >+ >+import org.eclipse.ptp.services.core.ServiceProvider; >+ >+/** >+ * A build service provider that does nothing. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author vkong >+ * >+ */ >+public class LocalBuildServiceProvider extends ServiceProvider { >+ >+ public static final String ID = "org.eclipse.ptp.rdt.ui.LocalBuildServiceProvider"; //$NON-NLS-1$ >+ public static final String SERVICE_ID = "org.eclipse.ptp.rdt.core.BuildService"; //$NON-NLS-1$ >+ >+ public LocalBuildServiceProvider() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.core.IServiceProvider#isConfigured() >+ */ >+ public boolean isConfigured() { >+ return true; >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/NewHPCProjectWizard.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/NewHPCProjectWizard.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/NewHPCProjectWizard.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/NewHPCProjectWizard.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,93 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.cdt.core.CCProjectNature; >+import org.eclipse.cdt.core.CProjectNature; >+import org.eclipse.cdt.ui.CUIPlugin; >+import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.ptp.internal.rdt.ui.RDTPluginImages; >+import org.eclipse.ptp.rdt.core.resources.RemoteNature; >+import org.eclipse.ptp.rdt.ui.wizards.RDTMainWizardPage; >+ >+/** >+ * A wizard for creating new Remote C/C++ Projects >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * >+ */ >+public class NewHPCProjectWizard extends CDTCommonProjectWizard { >+ private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$ >+ private static final String wz_title = "New HPC Project"; //$NON-NLS-1$ >+ private static final String wz_desc = "Create HPC Project of the selected type"; //$NON-NLS-1$ >+ >+ /** >+ * >+ */ >+ public NewHPCProjectWizard() { >+ >+ super(wz_title, wz_desc); >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard#continueCreation(org.eclipse.core.resources.IProject) >+ */ >+ >+ @Override >+ protected IProject continueCreation(IProject prj) { >+ try { >+ CProjectNature.addCNature(prj, new NullProgressMonitor()); >+ CCProjectNature.addCCNature(prj, new NullProgressMonitor()); >+ RemoteNature.addRemoteNature(prj, new NullProgressMonitor()); >+ } catch (CoreException e) {} >+ return prj; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard#getNatures() >+ */ >+ @Override >+ public String[] getNatures() { >+ return new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID, RemoteNature.REMOTE_NATURE_ID}; >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.wizards.newresource.BasicNewResourceWizard#initializeDefaultPageImageDescriptor() >+ */ >+ @Override >+ protected void initializeDefaultPageImageDescriptor() { >+ setDefaultPageImageDescriptor(RDTPluginImages.DESC_WIZBAN_NEW_REMOTE_C_PROJ); >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard#addPages() >+ */ >+ @Override >+ public void addPages() { >+ fMainPage= new RDTMainWizardPage(CUIPlugin.getResourceString(PREFIX)); >+ fMainPage.setTitle(wz_title); >+ fMainPage.setDescription(wz_desc); >+ addPage(fMainPage); >+ } >+ >+ >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalProjectServiceProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalProjectServiceProvider.java >diff -N src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalProjectServiceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newserviceproviders/LocalProjectServiceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,32 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newserviceproviders; >+ >+ >+/** >+ * A project location service provider that is local. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ */ >+public class LocalProjectServiceProvider extends AbstractRemoteServicesProvider { >+ public final static String ID = "org.eclipse.ptp.rdt.ui.LocalProjectLocationProvider"; //$NON-NLS-1$ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.core.IServiceProvider#isConfigured() >+ */ >+ public boolean isConfigured() { >+ return true; >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteBuildServiceProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteBuildServiceProvider.java >diff -N src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteBuildServiceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newserviceproviders/RemoteBuildServiceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,44 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newserviceproviders; >+ >+import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+ >+/** >+ * A build service provider that uses the Remote Tools API to provide execution services. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ */ >+public class RemoteBuildServiceProvider extends AbstractRemoteServicesProvider { >+ >+ public static final String ID = "org.eclipse.ptp.rdt.ui.RemoteBuildServiceProvider"; //$NON-NLS-1$ >+ public static final String SERVICE_ID = "org.eclipse.ptp.rdt.core.BuildService"; //$NON-NLS-1$ >+ public static final String NAME = Messages.getString("RemoteBuildServiceProvider.0"); //$NON-NLS-1$ >+ >+ public RemoteBuildServiceProvider() { >+ } >+ >+ public String toString() { >+ IRemoteConnection conn = getConnection(); >+ String name = "<not_configured>"; //$NON-NLS-1$ >+ if (conn != null) { >+ name = conn.getName(); >+ } >+ return "RemoteBuildServiceProvider(" + name + ")"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/ServiceModelWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/ServiceModelWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/ServiceModelWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/ServiceModelWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,274 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import java.net.URI; >+ >+import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage; >+import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.ptp.internal.rdt.ui.RDTHelpContextIds; >+import org.eclipse.ptp.rdt.core.services.IRDTServiceConstants; >+import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.rdt.ui.newserviceproviders.IRemoteServiceProvider; >+import org.eclipse.ptp.rdt.ui.newserviceproviders.RemoteBuildServiceProvider; >+import org.eclipse.ptp.rdt.ui.newserviceproviders.RemoteCIndexServiceProvider; >+import org.eclipse.ptp.rdt.ui.newserviceproviders.RemoteProjectServiceProvider; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+import org.eclipse.ptp.remote.core.PTPRemoteCorePlugin; >+import org.eclipse.ptp.services.core.IService; >+import org.eclipse.ptp.services.core.IServiceConfiguration; >+import org.eclipse.ptp.services.core.ServiceModelManager; >+import org.eclipse.ptp.services.ui.wizards.ServiceModelWidget; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Listener; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; >+ >+/** >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * >+ */ >+public class ServiceModelWizardPage extends MBSCustomPage { >+ >+ public static final String SERVICE_MODEL_WIZARD_PAGE_ID = "org.eclipse.ptp.rdt.ui.serviceModelWizardPage"; //$NON-NLS-1$ >+ public static final String SERVICE_CONFIGURATION_PROPERTY = "org.eclipse.ptp.rdt.ui.ServiceModelWizardPage.serviceConfiguration"; //$NON-NLS-1$ >+ >+ boolean fbVisited; >+ >+ private String fTitle; >+ >+ private String fDescription; >+ >+ private ImageDescriptor fImageDescriptor; >+ >+ private Image fImage; >+ >+ private Control fCanvas; >+ >+ ServiceModelWidget fModelWidget; >+ >+ /** >+ * @param pageID >+ */ >+ public ServiceModelWizardPage(String pageID) { >+ super(pageID); >+ fModelWidget = new ServiceModelWidget(null); >+ fModelWidget.setConfigChangeListener(new Listener() { >+ public void handleEvent(Event event) { >+ getWizard().getContainer().updateButtons(); >+ } >+ }); >+ } >+ >+ /** >+ * >+ */ >+ public ServiceModelWizardPage() { >+ this(SERVICE_MODEL_WIZARD_PAGE_ID); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage#isCustomPageComplete() >+ */ >+ protected boolean isCustomPageComplete() { >+ return fbVisited && fModelWidget.isConfigured(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.wizard.IWizardPage#getName() >+ */ >+ public String getName() { >+ return Messages.getString("ServiceModelWizardPage_0"); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public void createControl(Composite parent) { >+ fCanvas = fModelWidget.createContents(parent); >+ IServiceConfiguration config = createServiceConfiguration(); >+ fModelWidget.setServiceConfiguration(config); >+ MBSCustomPageManager.addPageProperty(pageID, SERVICE_CONFIGURATION_PROPERTY, config); >+ Control control = fCanvas.getParent().getShell(); //get the shell or doesn't display help correctly >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(control,RDTHelpContextIds.SERVICE_MODEL_WIZARD); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#dispose() >+ */ >+ public void dispose() { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#getControl() >+ */ >+ public Control getControl() { >+ return fCanvas; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#getDescription() >+ */ >+ public String getDescription() { >+ if (fDescription == null) >+ fDescription = Messages.getString("ServiceModelWizardPage_description"); //$NON-NLS-1$ >+ return fDescription; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage() >+ */ >+ public String getErrorMessage() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#getImage() >+ */ >+ public Image getImage() { >+ if(fImage == null && fImageDescriptor != null) >+ fImage = fImageDescriptor.createImage(); >+ >+ if (fImage == null && wizard != null) { >+ fImage = wizard.getDefaultPageImage(); >+ } >+ >+ return fImage; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#getMessage() >+ */ >+ public String getMessage() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#getTitle() >+ */ >+ public String getTitle() { >+ if (fTitle == null) >+ fTitle = Messages.getString("ServiceModelWizardPage_0"); //$NON-NLS-1$ >+ return fTitle; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#performHelp() >+ */ >+ public void performHelp() { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#setDescription(java.lang.String) >+ */ >+ public void setDescription(String description) { >+ fDescription = description; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#setImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) >+ */ >+ public void setImageDescriptor(ImageDescriptor image) { >+ fImageDescriptor = image; >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#setTitle(java.lang.String) >+ */ >+ public void setTitle(String title) { >+ fTitle = title; >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean) >+ */ >+ public void setVisible(boolean visible) { >+ if(visible) { >+ fbVisited = true; >+ } >+ fCanvas.setVisible(visible); >+ } >+ >+ private IServiceConfiguration createServiceConfiguration() { >+ ServiceModelManager manager = ServiceModelManager.getInstance(); >+ IWizard wizard = getWizard(); >+ if (!(wizard.getStartingPage() instanceof WizardNewProjectCreationPage)) { >+ return null; >+ } >+ >+ String name = ((WizardNewProjectCreationPage)wizard.getStartingPage()).getProjectName(); >+ URI location = ((WizardNewProjectCreationPage)wizard.getStartingPage()).getLocationURI(); >+ >+ /* >+ * Create a new service configuration >+ * >+ * XXX: this should check if a service configuration has already >+ * been selected, in which case it should use that one. >+ */ >+ IServiceConfiguration config = manager.newServiceConfiguration(name); >+ >+ /* >+ * Set default service providers based on location of project >+ */ >+ IRemoteServices remServ = PTPRemoteCorePlugin.getDefault().getRemoteServices(location); >+ IRemoteConnection remConn = PTPRemoteCorePlugin.getDefault().getConnection(location); >+ >+ /* >+ * Project location >+ */ >+ IService projectService = manager.getService(IRDTServiceConstants.SERVICE_PROJECT); >+ IRemoteServiceProvider projectProvider = (IRemoteServiceProvider) manager.getServiceProvider(projectService.getProviderDescriptor(RemoteProjectServiceProvider.ID)); >+ projectProvider.setRemoteServicesID(remServ.getId()); >+ projectProvider.setRemoteConnectionName(remConn.getName()); >+ config.setServiceProvider(projectService, projectProvider); >+ >+ /* >+ * Build service >+ */ >+ IService buildService = manager.getService(IRDTServiceConstants.SERVICE_BUILD); >+ IRemoteServiceProvider buildProvider = (IRemoteServiceProvider) manager.getServiceProvider(buildService.getProviderDescriptor(RemoteBuildServiceProvider.ID)); >+ buildProvider.setRemoteServicesID(remServ.getId()); >+ buildProvider.setRemoteConnectionName(remConn.getName()); >+ config.setServiceProvider(buildService, buildProvider); >+ >+ /* >+ * Index service >+ */ >+ IService indexService = manager.getService(IRDTServiceConstants.SERVICE_C_INDEX); >+ IRemoteServiceProvider indexProvider = (IRemoteServiceProvider) manager.getServiceProvider(indexService.getProviderDescriptor(RemoteCIndexServiceProvider.ID)); >+ indexProvider.setRemoteServicesID(remServ.getId()); >+ indexProvider.setRemoteConnectionName(remConn.getName()); >+ config.setServiceProvider(indexService, indexProvider); >+ >+ return config; >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/CIndexingServiceWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/CIndexingServiceWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/CIndexingServiceWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/CIndexingServiceWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,98 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.ptp.rdt.ui.newserviceproviders.LocalCIndexServiceProvider; >+import org.eclipse.ptp.rdt.ui.newserviceproviders.LocalProjectServiceProvider; >+import org.eclipse.ptp.rdt.ui.serviceproviders.RemoteCIndexServiceProvider; >+import org.eclipse.ptp.services.core.IService; >+import org.eclipse.ptp.services.core.IServiceConfiguration; >+import org.eclipse.ptp.services.core.IServiceProvider; >+import org.eclipse.ptp.services.core.ServiceModelManager; >+import org.eclipse.ptp.services.ui.wizards.ServiceConfigurationWizard; >+import org.eclipse.ptp.services.ui.wizards.ServiceConfigurationWizardPage; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+ >+/** >+ * Allows the user to select remote or local indexing. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * >+ */ >+public class CIndexingServiceWizardPage extends ServiceConfigurationWizardPage { >+ public CIndexingServiceWizardPage(IService service, String pageName) { >+ super(service, pageName); >+ setTitle(pageName); >+ setDescription("This page allows you to set the location where your project will be indexed."); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.wizards.ServiceConfigurationWizardPage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ @Override >+ public void createControl(Composite parent) { >+ Composite container = new Composite(parent, SWT.NONE); >+ >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 1; >+ container.setLayout(layout); >+ >+ Label label = new Label(container, SWT.LEFT); >+ label.setText("The index location should normally be the same as the location of the project source files, which is the default."); //$NON-NLS-1$ >+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); >+ label.setLayoutData(data); >+ >+ Label label2 = new Label(container, SWT.LEFT); >+ label2.setText("Only change this if you know what your are doing."); //$NON-NLS-1$ >+ GridData data2 = new GridData(SWT.FILL, SWT.FILL, true, false); >+ label.setLayoutData(data2); >+ >+ super.createControl(container); >+ >+ setControl(container); >+ >+ setDefaultProvider(getService()); >+ } >+ >+ /** >+ * Set the default service provider based on the project location service >+ * >+ * @param service >+ */ >+ private void setDefaultProvider(IService service) { >+ IServiceConfiguration config = ((ServiceConfigurationWizard)getWizard()).getServiceConfiguration(); >+ IService projectLocationService = ServiceModelManager.getInstance().getService(ProjectLocationServiceContributor.SERVICE_ID); >+ if (projectLocationService != null) { >+ String providerID = null; >+ IServiceProvider projectLocationProvider = config.getServiceProvider(projectLocationService); >+ if (projectLocationProvider.getId().equals(LocalProjectServiceProvider.ID)) { >+ providerID = LocalCIndexServiceProvider.ID; >+ } else if (projectLocationProvider.getId().equals(LocalProjectServiceProvider.ID)) { >+ providerID = RemoteCIndexServiceProvider.ID; >+ } >+ if (providerID != null) { >+ IServiceProvider provider = ServiceModelManager.getInstance().getServiceProvider(service.getProviderDescriptor(providerID)); >+ if (provider != null) { >+ config.setServiceProvider(service, provider); >+ } >+ } >+ } >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCIndexConfigurationWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCIndexConfigurationWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCIndexConfigurationWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCIndexConfigurationWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,168 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.jface.wizard.WizardDialog; >+import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.rdt.ui.serviceproviders.RemoteCIndexServiceProvider; >+import org.eclipse.ptp.services.ui.wizards.ServiceProviderConfigurationWizardPage; >+import org.eclipse.rse.connectorservice.dstore.DStoreConnectorService; >+import org.eclipse.rse.core.model.IHost; >+import org.eclipse.rse.core.model.SystemStartHere; >+import org.eclipse.rse.core.subsystems.IConnectorService; >+import org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard; >+import org.eclipse.rse.ui.wizards.newconnection.RSEMainNewConnectionWizard; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Combo; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+ >+/** >+ * Allows the configure a RemoteCIndexServiceProvider. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * @see org.eclipse.ptp.rdt.ui.serviceproviders.RemoteBuildServiceProvider >+ * >+ */ >+public class RemoteCIndexConfigurationWizardPage extends ServiceProviderConfigurationWizardPage { >+ private Map<Integer, IHost> fHostComboIndexToHostMap = new HashMap<Integer, IHost>(); >+ private IHost fSelectedHost; >+ private RemoteCIndexServiceProvider fProvider; >+ >+ public RemoteCIndexConfigurationWizardPage(RemoteCIndexServiceProvider provider, String pageName) { >+ super(pageName); >+ this.fProvider = provider; >+ setTitle(pageName); >+ setDescription(Messages.getString("HostSelectionDialog.1")); //$NON-NLS-1$ >+ } >+ >+ @Override >+ public void createControl(Composite parent) { >+ Composite container = new Composite(parent, SWT.NONE); >+ >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 3; >+ container.setLayout(layout); >+ setControl(container); >+ >+ Label label1 = new Label(container, SWT.LEFT); >+ label1.setText("The Remote C/C++ Indexer currently only supports RSE connections."); //$NON-NLS-1$ >+ GridData data = new GridData(); >+ data.horizontalSpan = 3; >+ label1.setLayoutData(data); >+ >+ Label label2 = new Label(container, SWT.LEFT); >+ label2.setText("Select a host from the list below, or create a new host by selecting the \"New\" button."); //$NON-NLS-1$ >+ GridData data2 = new GridData(); >+ data2.horizontalSpan = 3; >+ label2.setLayoutData(data2); >+ >+ // Label for "Host:" >+ Label hostLabel = new Label(container, SWT.LEFT); >+ hostLabel.setText(Messages.getString("HostSelectionDialog_0")); //$NON-NLS-1$ >+ >+ // combo for hosts >+ final Combo hostCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY); >+ // set layout to grab horizontal space >+ hostCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); >+ >+ //attempt to restore settings from saved state >+ IHost hostSelected = fProvider.getHost(); >+ >+ // populate the combo with a list of hosts >+ IHost[] hosts = SystemStartHere.getConnections(); >+ int toSelect = 0; >+ >+ for(int k = 0; k < hosts.length; k++) { >+ hostCombo.add(hosts[k].getAliasName(), k); >+ fHostComboIndexToHostMap.put(k, hosts[k]); >+ >+ if (hostSelected != null && hostSelected.getAliasName().compareTo(hosts[k].getAliasName()) == 0) { >+ toSelect = k; >+ } >+ } >+ >+ // set selected host to be the first one if we're not restoring from settings >+ hostCombo.select(toSelect); >+ fSelectedHost = fHostComboIndexToHostMap.get(toSelect); >+ >+ >+ hostCombo.addSelectionListener(new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ int selectionIndex = hostCombo.getSelectionIndex(); >+ fSelectedHost = fHostComboIndexToHostMap.get(selectionIndex); >+ fProvider.setConnection(fSelectedHost, getDStoreConnectorService(fSelectedHost)); >+ fProvider.setConfigured(true); >+ } >+ >+ }); >+ >+ // button for creating new connections >+ Button newConnectionButton = new Button(container, SWT.PUSH); >+ newConnectionButton.setText(Messages.getString("HostSelectionDialog.0")); //$NON-NLS-1$ >+ newConnectionButton.addSelectionListener(new SelectionAdapter() { >+ >+ public void widgetSelected(SelectionEvent e) { >+ // launch the RSE New Connection Wizard >+ RSEMainNewConnectionWizard wizard = new RSEMainNewConnectionWizard(); >+ WizardDialog wizardDialog = new WizardDialog(getShell(), wizard); >+ wizardDialog.open(); >+ >+ IWizard actualWizard = wizard.getSelectedWizard(); >+ if(actualWizard instanceof RSEDefaultNewConnectionWizard) { >+ // get the new host, if any >+ IHost host = ((RSEDefaultNewConnectionWizard)actualWizard).getCreatedHost(); >+ >+ // add the host >+ int index = hostCombo.getItemCount() - 1; >+ hostCombo.add(host.getAliasName(), index); >+ fHostComboIndexToHostMap.put(index, host); >+ >+ // select the new host >+ hostCombo.select(index); >+ fSelectedHost = host; >+ } >+ } >+ >+ }); >+ } >+ >+ private IConnectorService getDStoreConnectorService(IHost host) { >+ IConnectorService[] connectorServices = host.getConnectorServices(); >+ >+ for(int k = 0; k < connectorServices.length; k++) { >+ if(connectorServices[k] instanceof DStoreConnectorService) >+ return connectorServices[k]; >+ } >+ >+ return null; >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteServicesConfigurationWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteServicesConfigurationWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteServicesConfigurationWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteServicesConfigurationWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,211 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.rdt.ui.newserviceproviders.AbstractRemoteServicesProvider; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+import org.eclipse.ptp.remote.core.PTPRemoteCorePlugin; >+import org.eclipse.ptp.remote.ui.IRemoteUIConnectionManager; >+import org.eclipse.ptp.remote.ui.PTPRemoteUIPlugin; >+import org.eclipse.ptp.services.ui.wizards.ServiceProviderConfigurationWizardPage; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Combo; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+ >+/** >+ * Allows the user to select a provider of Remote Services for a RemoteBuildServiceProvider. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * @see org.eclipse.ptp.rdt.ui.serviceproviders.RemoteBuildServiceProvider >+ * >+ */ >+public class RemoteServicesConfigurationWizardPage extends ServiceProviderConfigurationWizardPage { >+ private AbstractRemoteServicesProvider fProvider; >+ private Map<Integer, IRemoteServices> fComboIndexToRemoteServicesProviderMap = new HashMap<Integer, IRemoteServices>(); >+ private IRemoteServices fSelectedProvider; >+ private Map<Integer, IRemoteConnection> fComboIndexToRemoteConnectionMap = new HashMap<Integer, IRemoteConnection>(); >+ private IRemoteConnection fSelectedConnection; >+ >+ public RemoteServicesConfigurationWizardPage(AbstractRemoteServicesProvider provider, String pageName) { >+ super(pageName); >+ this.fProvider = provider; >+ setTitle(pageName); >+ setDescription(Messages.getString("RemoteServicesProviderSelectionDialog_0")); //$NON-NLS-1$ >+ } >+ >+ @Override >+ public void createControl(Composite parent) { >+ Composite container = new Composite(parent, SWT.NONE); >+ >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 3; >+ container.setLayout(layout); >+ setControl(container); >+ >+ // Label for "Provider:" >+ Label providerLabel = new Label(container, SWT.LEFT); >+ providerLabel.setText(Messages.getString("RemoteServicesProviderSelectionDialog_1")); //$NON-NLS-1$ >+ >+ // combo for providers >+ final Combo providerCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY); >+ // set layout to grab horizontal space >+ GridData data = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false); >+ data.horizontalSpan = 2; >+ providerCombo.setLayoutData(data); >+ >+ //attempt to restore settings from saved state >+ IRemoteServices providerSelected = fProvider.getRemoteServices(); >+ >+ // populate the combo with a list of providers >+ IRemoteServices[] providers = PTPRemoteCorePlugin.getDefault().getAllRemoteServices(); >+ int toSelect = 0; >+ >+ for(int k = 0; k < providers.length; k++) { >+ providerCombo.add(providers[k].getName(), k); >+ fComboIndexToRemoteServicesProviderMap.put(k, providers[k]); >+ >+ if (providerSelected != null && providerSelected.getName().compareTo(providers[k].getName()) == 0) { >+ toSelect = k; >+ } >+ } >+ >+ // set selected host to be the first one if we're not restoring from settings >+ providerCombo.select(toSelect); >+ fSelectedProvider = fComboIndexToRemoteServicesProviderMap.get(toSelect); >+ >+ // connection combo >+ // Label for "Connection:" >+ Label connectionLabel = new Label(container, SWT.LEFT); >+ connectionLabel.setText(Messages.getString("RemoteServicesProviderSelectionDialog.0")); //$NON-NLS-1$ >+ >+ // combo for providers >+ final Combo connectionCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY); >+ // set layout to grab horizontal space >+ connectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); >+ >+ // populate the combo with a list of providers >+ populateConnectionCombo(connectionCombo); >+ >+ // new connection button >+ final Button newConnectionButton = new Button(container, SWT.PUSH); >+ newConnectionButton.setText(Messages.getString("RemoteServicesProviderSelectionDialog.1")); //$NON-NLS-1$ >+ updateNewConnectionButtonEnabled(newConnectionButton); >+ >+ newConnectionButton.addSelectionListener(new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ >+ IRemoteUIConnectionManager connectionManager = getUIConnectionManager(); >+ if(connectionManager != null) { >+ connectionManager.newConnection(getShell()); >+ } >+ >+ // refresh list of connections >+ populateConnectionCombo(connectionCombo); >+ } >+ >+ }); >+ >+ providerCombo.addSelectionListener(new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ int selectionIndex = providerCombo.getSelectionIndex(); >+ fSelectedProvider = fComboIndexToRemoteServicesProviderMap.get(selectionIndex); >+ >+ populateConnectionCombo(connectionCombo); >+ updateNewConnectionButtonEnabled(newConnectionButton); >+ fProvider.setRemoteServicesID(fSelectedProvider.getId()); >+ if (fSelectedConnection != null) { >+ fProvider.setRemoteConnectionName(fSelectedConnection.getName()); >+ setPageComplete(true); >+ } >+ } >+ >+ }); >+ >+ connectionCombo.addSelectionListener(new SelectionListener() { >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ int selectionIndex = connectionCombo.getSelectionIndex(); >+ fSelectedConnection = fComboIndexToRemoteConnectionMap.get(selectionIndex); >+ updateNewConnectionButtonEnabled(newConnectionButton); >+ fProvider.setRemoteConnectionName(fSelectedConnection.getName()); >+ setPageComplete(true); >+ } >+ >+ }); >+ } >+ >+ private IRemoteUIConnectionManager getUIConnectionManager() { >+ IRemoteUIConnectionManager connectionManager = PTPRemoteUIPlugin.getDefault().getRemoteUIServices(fSelectedProvider) >+ .getUIConnectionManager(); >+ return connectionManager; >+ } >+ >+ /** >+ * @param connectionCombo >+ */ >+ private void populateConnectionCombo(final Combo connectionCombo) { >+ connectionCombo.removeAll(); >+ >+ //attempt to restore settings from saved state >+ IRemoteConnection connectionSelected = fProvider.getConnection(); >+ >+ IRemoteConnection[] connections = fSelectedProvider.getConnectionManager().getConnections(); >+ int toSelect = 0; >+ >+ for(int k = 0; k < connections.length; k++) { >+ connectionCombo.add(connections[k].getName(), k); >+ fComboIndexToRemoteConnectionMap.put(k, connections[k]); >+ >+ if (connectionSelected != null && connectionSelected.getName().compareTo(connections[k].getName()) == 0) { >+ toSelect = k; >+ } >+ } >+ >+ // set selected connection to be the first one if we're not restoring from settings >+ connectionCombo.select(toSelect); >+ fSelectedConnection = fComboIndexToRemoteConnectionMap.get(toSelect); >+ } >+ >+ private void updateNewConnectionButtonEnabled(Button button) { >+ IRemoteUIConnectionManager connectionManager = getUIConnectionManager(); >+ button.setEnabled(connectionManager != null); >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectContentsLocationArea.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectContentsLocationArea.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectContentsLocationArea.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteProjectContentsLocationArea.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,475 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import java.lang.reflect.InvocationTargetException; >+import java.net.URI; >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.filesystem.URIUtil; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.jface.dialogs.ErrorDialog; >+import org.eclipse.jface.dialogs.ProgressMonitorDialog; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.ptp.rdt.ui.serviceproviders.RemoteBuildServiceProvider; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+import org.eclipse.ptp.remote.core.PTPRemoteCorePlugin; >+import org.eclipse.ptp.remote.core.exception.RemoteConnectionException; >+import org.eclipse.ptp.remote.ui.IRemoteUIConnectionManager; >+import org.eclipse.ptp.remote.ui.IRemoteUIFileManager; >+import org.eclipse.ptp.remote.ui.IRemoteUIServices; >+import org.eclipse.ptp.remote.ui.PTPRemoteUIPlugin; >+import org.eclipse.ptp.services.ui.Activator; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+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.Group; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; >+import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; >+ >+/** >+ * Allows the user to select a provider of Remote Services for a RemoteBuildServiceProvider. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * @see org.eclipse.ptp.rdt.ui.serviceproviders.RemoteBuildServiceProvider >+ */ >+public class RemoteProjectContentsLocationArea { >+ >+ /** >+ * IErrorMessageReporter is an interface for type that allow message >+ * reporting. >+ * >+ */ >+ public interface IErrorMessageReporter { >+ /** >+ * Report the error message >+ * >+ * @param errorMessage >+ * String or <code>null</code>. If the errorMessage is >+ * null then clear any error state. >+ * @param infoOnly >+ * the message is an informational message, but the dialog >+ * cannot continue >+ * >+ */ >+ public void reportError(String errorMessage, boolean infoOnly); >+ } >+ >+ private static final String FILE_SCHEME = "file"; //$NON-NLS-1$ >+ >+ private IProject fExistingProject; >+ >+ private IErrorMessageReporter fErrorReporter; >+ >+ private RemoteBuildServiceProvider fProvider; >+ >+ private Map<Integer, IRemoteServices> fComboIndexToRemoteServicesProviderMap = new HashMap<Integer, IRemoteServices>(); >+ >+ private IRemoteServices fSelectedProvider; >+ >+ private Map<Integer, IRemoteConnection> fComboIndexToRemoteConnectionMap = new HashMap<Integer, IRemoteConnection>(); >+ >+ private IRemoteConnection fSelectedConnection; >+ >+ private String fProjectName = IDEResourceInfoUtils.EMPTY_STRING; >+ >+ private Button fBrowseButton; >+ >+ private Button fNewConnectionButton; >+ >+ private Combo fProviderCombo; >+ >+ private Combo fConnectionCombo; >+ >+ private Text fLocationText; >+ >+// public RemoteProjectContentsLocationArea(IServiceProvider provider, Composite composite) { >+// if(provider instanceof RemoteBuildServiceProvider) >+// fProvider = (RemoteBuildServiceProvider) provider; >+// else >+// throw new IllegalArgumentException(); // should never happen >+// createContents(composite); >+// } >+ public RemoteProjectContentsLocationArea(IErrorMessageReporter reporter, Composite composite) { >+ fErrorReporter = reporter; >+ createContents(composite); >+ } >+ >+ /** >+ * Check if the entry in the widget location is valid. If it is valid return >+ * null. Otherwise return a string that indicates the problem. >+ * >+ * @return String >+ */ >+ public String checkValidLocation() { >+ >+ String locationFieldContents = fLocationText.getText(); >+ if (locationFieldContents.length() == 0) { >+ return IDEWorkbenchMessages.WizardNewProjectCreationPage_projectLocationEmpty; >+ } >+ >+ URI newPath = getProjectLocationURI(); >+ if (newPath == null) { >+ return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; >+ } >+ >+ if (fExistingProject != null) { >+ URI projectPath = fExistingProject.getLocationURI(); >+ if (projectPath != null && URIUtil.equals(projectPath, newPath)) { >+ return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationIsSelf; >+ } >+ } >+ >+ return null; >+ } >+ >+ /** >+ * Return the browse button. Usually referenced in order to set the layout >+ * data for a dialog. >+ * >+ * @return Button >+ */ >+ public Button[] getButtons() { >+ return new Button[]{fBrowseButton, fNewConnectionButton}; >+ } >+ >+ /** >+ * Get the URI for the location field if possible. >+ * >+ * @return URI or <code>null</code> if it is not valid. >+ */ >+ public URI getProjectLocationURI() { >+ return fSelectedProvider.getFileManager(fSelectedConnection).toURI(new Path(fLocationText.getText())); >+ } >+ >+ /** >+ * Return whether or not we are currently showing the default location for >+ * the project. >+ * >+ * @return boolean >+ */ >+ public boolean isDefault() { >+// return useDefaultsButton.getSelection(); >+ return false; >+ } >+ >+ /** >+ * Set the project to base the contents off of. >+ * >+ * @param existingProject >+ */ >+ public void setExistingProject(IProject existingProject) { >+ fProjectName = existingProject.getName(); >+ fExistingProject = existingProject; >+ } >+ >+ /** >+ * Set the text to the default or clear it if not using the defaults. >+ * >+ * @param newName >+ * the name of the project to use. If <code>null</code> use the >+ * existing project name. >+ */ >+ public void updateProjectName(String newName) { >+ fProjectName = newName; >+ if (isDefault()) { >+// locationPathField.setText(TextProcessor >+// .process(getDefaultPathDisplayString())); >+ } >+ >+ } >+ >+ /** >+ * Attempt to open a connection. >+ */ >+ private void checkConnection() { >+ if (!fSelectedConnection.isOpen()) { >+ IRunnableWithProgress op = new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) >+ throws InvocationTargetException, >+ InterruptedException { >+ try { >+ fSelectedConnection.open(monitor); >+ if (monitor.isCanceled()) { >+ throw new InterruptedException("Cancelled by user"); //$NON-NLS-1$ >+ } >+ } catch (RemoteConnectionException e) { >+ throw new InvocationTargetException(e); >+ } >+ } >+ >+ }; >+ try { >+ new ProgressMonitorDialog(fConnectionCombo.getShell()).run(true, true, op); >+ } catch (InvocationTargetException e) { >+ ErrorDialog.openError(fConnectionCombo.getShell(), "Connection error", //$NON-NLS-1$ >+ "Could not open connection", //$NON-NLS-1$ >+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getCause().getMessage())); >+ } catch (InterruptedException e) { >+ ErrorDialog.openError(fConnectionCombo.getShell(), "Connection error", //$NON-NLS-1$ >+ "Could not open connection", //$NON-NLS-1$ >+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage())); >+ } >+ } >+ } >+ >+ /** >+ * Return the path we are going to display. If it is a file URI then remove >+ * the file prefix. >+ * >+ * @return String >+ */ >+ private String getDefaultPathDisplayString() { >+ >+ URI defaultURI = null; >+ if (fExistingProject != null) { >+ defaultURI = fExistingProject.getLocationURI(); >+ } >+ >+ // Handle files specially. Assume a file if there is no project to query >+ if (defaultURI == null || defaultURI.getScheme().equals(FILE_SCHEME)) { >+ return Platform.getLocation().append(fProjectName).toOSString(); >+ } >+ return defaultURI.toString(); >+ >+ } >+ >+ /** >+ * @return >+ */ >+ private IRemoteUIConnectionManager getUIConnectionManager() { >+ IRemoteUIConnectionManager connectionManager = PTPRemoteUIPlugin.getDefault().getRemoteUIServices(fSelectedProvider) >+ .getUIConnectionManager(); >+ return connectionManager; >+ } >+ >+ >+ /** >+ * @param connectionCombo >+ */ >+ private void populateConnectionCombo(final Combo connectionCombo) { >+ connectionCombo.removeAll(); >+ >+ //attempt to restore settings from saved state >+// IRemoteConnection connectionSelected = fProvider.getConnection(); >+ >+ IRemoteConnection[] connections = fSelectedProvider.getConnectionManager().getConnections(); >+ int toSelect = 0; >+ >+ for(int k = 0; k < connections.length; k++) { >+ connectionCombo.add(connections[k].getName(), k); >+ fComboIndexToRemoteConnectionMap .put(k, connections[k]); >+ >+// if (connectionSelected != null && connectionSelected.getName().compareTo(connections[k].getName()) == 0) { >+// toSelect = k; >+// } >+ } >+ >+ // set selected connection to be the first one if we're not restoring from settings >+ connectionCombo.select(toSelect); >+ fSelectedConnection = fComboIndexToRemoteConnectionMap.get(toSelect); >+ } >+ >+ /** >+ * @param button >+ */ >+ private void updateNewConnectionButtonEnabled(Button button) { >+ IRemoteUIConnectionManager connectionManager = getUIConnectionManager(); >+ button.setEnabled(connectionManager != null); >+ } >+ >+ protected Control createContents(Composite parent) { >+ Group container = new Group(parent, SWT.SHADOW_ETCHED_IN); >+ >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 3; >+ container.setLayout(layout); >+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); >+ container.setLayoutData(gd); >+ >+ // Label for "Provider:" >+ Label providerLabel = new Label(container, SWT.LEFT); >+ providerLabel.setText("Remote Provider:"); //$NON-NLS-1$ >+ >+ // combo for providers >+ fProviderCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY); >+ // set layout to grab horizontal space >+ fProviderCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false)); >+ gd = new GridData(); >+ gd.horizontalSpan = 2; >+ fProviderCombo.setLayoutData(gd); >+ fProviderCombo.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ int selectionIndex = fProviderCombo.getSelectionIndex(); >+ fSelectedProvider = fComboIndexToRemoteServicesProviderMap.get(selectionIndex); >+ >+ populateConnectionCombo(fConnectionCombo); >+ updateNewConnectionButtonEnabled(fNewConnectionButton); >+ } >+ }); >+ >+ //attempt to restore settings from saved state >+// IRemoteServices providerSelected = fProvider.getRemoteServices(); >+ >+ // populate the combo with a list of providers >+ IRemoteServices[] providers = PTPRemoteCorePlugin.getDefault().getAllRemoteServices(); >+ int toSelect = 0; >+ >+ for(int k = 0; k < providers.length; k++) { >+ fProviderCombo.add(providers[k].getName(), k); >+ fComboIndexToRemoteServicesProviderMap.put(k, providers[k]); >+ >+// if (providerSelected != null && providerSelected.getName().compareTo(providers[k].getName()) == 0) { >+// toSelect = k; >+// } >+ } >+ >+ // set selected host to be the first one if we're not restoring from settings >+ fProviderCombo.select(toSelect); >+ fSelectedProvider = fComboIndexToRemoteServicesProviderMap.get(toSelect); >+ >+ // connection combo >+ // Label for "Connection:" >+ Label connectionLabel = new Label(container, SWT.LEFT); >+ connectionLabel.setText("Connection:"); //$NON-NLS-1$ >+ >+ // combo for providers >+ fConnectionCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY); >+ // set layout to grab horizontal space >+ fConnectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); >+ fConnectionCombo.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ int selectionIndex = fConnectionCombo.getSelectionIndex(); >+ fSelectedConnection = fComboIndexToRemoteConnectionMap.get(selectionIndex); >+ updateNewConnectionButtonEnabled(fNewConnectionButton); >+ } >+ }); >+ >+ // populate the combo with a list of providers >+ populateConnectionCombo(fConnectionCombo); >+ >+ // new connection button >+ fNewConnectionButton = new Button(container, SWT.PUSH); >+ fNewConnectionButton.setText("New..."); //$NON-NLS-1$ >+ updateNewConnectionButtonEnabled(fNewConnectionButton); >+ fNewConnectionButton.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ IRemoteUIConnectionManager connectionManager = getUIConnectionManager(); >+ if(connectionManager != null) { >+ connectionManager.newConnection(fNewConnectionButton.getShell()); >+ } >+ // refresh list of connections >+ populateConnectionCombo(fConnectionCombo); >+ } >+ }); >+ >+ Label locationLabel = new Label(container, SWT.LEFT); >+ locationLabel.setText("Location:"); //$NON-NLS-1$ >+ >+ fLocationText = new Text(container, SWT.SINGLE | SWT.BORDER); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = 1; >+ gd.grabExcessHorizontalSpace = true; >+ gd.widthHint = 250; >+ fLocationText.setLayoutData(gd); >+ fLocationText.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ fErrorReporter.reportError(checkValidLocation(), false); >+ } >+ }); >+ >+ // new connection button >+ fBrowseButton = new Button(container, SWT.PUSH); >+ fBrowseButton.setText("Browse..."); //$NON-NLS-1$ >+ fBrowseButton.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ if (fSelectedConnection != null) { >+ checkConnection(); >+ if (fSelectedConnection.isOpen()) { >+ IRemoteUIServices remoteUIServices = PTPRemoteUIPlugin.getDefault().getRemoteUIServices(fSelectedProvider); >+ if (remoteUIServices != null) { >+ IRemoteUIFileManager fileMgr = remoteUIServices.getUIFileManager(); >+ if (fileMgr != null) { >+ fileMgr.setConnection(fSelectedConnection); >+ String correctPath = fLocationText.getText(); >+ IPath selectedPath = fileMgr.browseDirectory(fLocationText.getShell(), "Project Location", correctPath); //$NON-NLS-1$ >+ if (selectedPath != null) { >+ fLocationText.setText(selectedPath.toString()); >+ } >+ } >+ } >+ } >+ } >+ } >+ }); >+ >+ return container; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.Dialog#okPressed() >+ */ >+ protected void okPressed() { >+ >+ // set the provider >+ fProvider.setRemoteToolsProviderID(fSelectedProvider.getId()); >+ fProvider.setRemoteToolsConnection(fSelectedConnection); >+ >+ } >+ >+ /** >+ * Return the location for the project. >+ * >+ * @return String >+ */ >+ public String getProjectLocation() { >+ return fLocationText.getText(); >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteMainWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteMainWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteMainWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteMainWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,543 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2008 Intel 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Intel Corporation - initial API and implementation >+ * IBM Corporation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+import java.net.URI; >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.LinkedList; >+import java.util.List; >+ >+import org.eclipse.cdt.internal.ui.CPluginImages; >+import org.eclipse.cdt.ui.CUIPlugin; >+import org.eclipse.cdt.ui.newui.CDTPrefUtil; >+import org.eclipse.cdt.ui.newui.PageLayout; >+import org.eclipse.cdt.ui.newui.UIMessages; >+import org.eclipse.cdt.ui.wizards.CNewWizard; >+import org.eclipse.cdt.ui.wizards.CWizardHandler; >+import org.eclipse.cdt.ui.wizards.EntryDescriptor; >+import org.eclipse.cdt.ui.wizards.IWizardItemsListListener; >+import org.eclipse.cdt.ui.wizards.IWizardWithMemory; >+import org.eclipse.core.filesystem.EFS; >+import org.eclipse.core.filesystem.IFileInfo; >+import org.eclipse.core.filesystem.IFileStore; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtension; >+import org.eclipse.core.runtime.IExtensionPoint; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.jface.wizard.IWizardPage; >+import org.eclipse.osgi.util.TextProcessor; >+import org.eclipse.ptp.internal.rdt.ui.RDTHelpContextIds; >+import org.eclipse.ptp.services.core.IServiceConfiguration; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.accessibility.AccessibleAdapter; >+import org.eclipse.swt.accessibility.AccessibleEvent; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Tree; >+import org.eclipse.swt.widgets.TreeItem; >+import org.eclipse.ui.PlatformUI; >+ >+public class RemoteMainWizardPage extends NewRemoteProjectCreationPage implements IWizardItemsListListener { >+ private static final Image IMG_CATEGORY = CPluginImages.get(CPluginImages.IMG_OBJS_SEARCHFOLDER); >+ private static final Image IMG_ITEM = CPluginImages.get(CPluginImages.IMG_OBJS_VARIABLE); >+ >+ public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.NewModelProjectWizardPage"; //$NON-NLS-1$ >+ >+ private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.CDTWizard"; //$NON-NLS-1$ >+ private static final String ELEMENT_NAME = "wizard"; //$NON-NLS-1$ >+ private static final String CLASS_NAME = "class"; //$NON-NLS-1$ >+ public static final String DESC = "EntryDescriptor"; //$NON-NLS-1$ >+ >+ // widgets >+ private Tree tree; >+ private Composite right; >+ private Button show_sup; >+ private Label right_label; >+ >+ public CWizardHandler h_selected = null; >+ private Label categorySelectedLabel; >+ >+ private IServiceConfiguration defaultConfig = null; >+ >+ /** >+ * Creates a new project creation wizard page. >+ * >+ * @param pageName the name of this page >+ */ >+ public RemoteMainWizardPage(String pageName) { >+ super(pageName); >+ setPageComplete(false); >+ // default to view all toolchains >+ CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSUPP, true); >+ } >+ >+ /** (non-Javadoc) >+ * Method declared on IDialogPage. >+ */ >+ @Override >+ public void createControl(Composite parent) { >+ super.createControl(parent); >+ >+ createDynamicGroup((Composite)getControl()); >+ switchTo(updateData(tree, right, show_sup, RemoteMainWizardPage.this, getWizard()), >+ getDescriptor(tree)); >+ >+ setPageComplete(validatePage()); >+ setErrorMessage(null); >+ setMessage(null); >+ >+ Shell shell = getContainer().getShell(); //if not created on the shell, will not display properly >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, RDTHelpContextIds.CREATING_A_REMOTE_PROJECT); >+ } >+ >+ private void createDynamicGroup(Composite parent) { >+ Composite c = new Composite(parent, SWT.NONE); >+ c.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ c.setLayout(new GridLayout(2, true)); >+ >+ Label l1 = new Label(c, SWT.NONE); >+ l1.setText(UIMessages.getString("CMainWizardPage.0")); //$NON-NLS-1$ >+ l1.setFont(parent.getFont()); >+ l1.setLayoutData(new GridData(GridData.BEGINNING)); >+ >+ right_label = new Label(c, SWT.NONE); >+ right_label.setFont(parent.getFont()); >+ right_label.setLayoutData(new GridData(GridData.BEGINNING)); >+ >+ tree = new Tree(c, SWT.SINGLE | SWT.BORDER); >+ tree.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ tree.addSelectionListener(new SelectionAdapter() { >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ TreeItem[] tis = tree.getSelection(); >+ if (tis == null || tis.length == 0) return; >+ switchTo((CWizardHandler)tis[0].getData(), (EntryDescriptor)tis[0].getData(DESC)); >+ setPageComplete(validatePage()); >+ }}); >+ tree.getAccessible().addAccessibleListener( >+ new AccessibleAdapter() { >+ @Override >+ public void getName(AccessibleEvent e) { >+ for (int i = 0; i < tree.getItemCount(); i++) { >+ if (tree.getItem(i).getText().compareTo(e.result) == 0) >+ return; >+ } >+ e.result = UIMessages.getString("CMainWizardPage.0"); //$NON-NLS-1$ >+ } >+ } >+ ); >+ right = new Composite(c, SWT.NONE); >+ right.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ right.setLayout(new PageLayout()); >+ >+ show_sup = new Button(c, SWT.CHECK); >+ show_sup.setText(UIMessages.getString("CMainWizardPage.1")); //$NON-NLS-1$ >+ GridData gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = 2; >+ show_sup.setLayoutData(gd); >+ show_sup.addSelectionListener(new SelectionAdapter() { >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ if (h_selected != null) >+ h_selected.setSupportedOnly(show_sup.getSelection()); >+ switchTo(updateData(tree, right, show_sup, RemoteMainWizardPage.this, getWizard()), >+ getDescriptor(tree)); >+ }} ); >+ >+ // restore settings from preferences >+ show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP)); >+ } >+ >+ @Override >+ public IWizardPage getNextPage() { >+ return (h_selected == null) ? null : h_selected.getSpecificPage(); >+ } >+ >+ public URI getProjectLocation() { >+ return useDefaults() ? null : getLocationURI(); >+ } >+ >+ /** >+ * Returns whether this page's controls currently all contain valid >+ * values. >+ * >+ * @return <code>true</code> if all controls are valid, and >+ * <code>false</code> if at least one is invalid >+ */ >+ @Override >+ protected boolean validatePage() { >+ setMessage(null); >+ if (!super.validatePage()) >+ return false; >+ >+ if (getProjectName().indexOf('#') >= 0) { >+ setErrorMessage(UIMessages.getString("RemoteMainWizardPage.0")); //$NON-NLS-1$ >+ return false; >+ } >+ >+ boolean bad = true; // should we treat existing project as error >+ >+ IProject handle = getProjectHandle(); >+ if (handle.exists()) { >+ if (getWizard() instanceof IWizardWithMemory) { >+ IWizardWithMemory w = (IWizardWithMemory)getWizard(); >+ if (w.getLastProjectName() != null && w.getLastProjectName().equals(getProjectName())) >+ bad = false; >+ } >+ if (bad) { >+ setErrorMessage(UIMessages.getString("CMainWizardPage.10")); //$NON-NLS-1$ >+ return false; >+ } >+ } >+ >+ if (bad) { // skip this check if project already created >+ try { >+ IFileStore fs; >+ URI p = getProjectLocation(); >+ if (p == null) { >+ fs = EFS.getStore(ResourcesPlugin.getWorkspace().getRoot().getLocationURI()); >+ fs = fs.getChild(getProjectName()); >+ } else >+ fs = EFS.getStore(p); >+ IFileInfo f = fs.fetchInfo(); >+ if (f.exists() && f.isDirectory()) { >+ if (fs.getChild(".project").fetchInfo().exists()) { //$NON-NLS-1$ >+ setMessage("Existing project settings will be overridden"); //$NON-NLS-1$ >+ return true; >+ } >+ } >+ } catch (CoreException e) { >+ CUIPlugin.log(e.getStatus()); >+ } >+ } >+ >+ if (!useDefaults()) { >+ IStatus locationStatus = ResourcesPlugin.getWorkspace().validateProjectLocationURI(handle, >+ getLocationURI()); >+ if (!locationStatus.isOK()) { >+ setErrorMessage(locationStatus.getMessage()); >+ return false; >+ } >+ } >+ >+ if (tree.getItemCount() == 0) { >+ setErrorMessage(UIMessages.getString("CMainWizardPage.3")); //$NON-NLS-1$ >+ return false; >+ } >+ >+ // it is not an error, but we cannot continue >+ if (h_selected == null) { >+ setErrorMessage(null); >+ return false; >+ } >+ >+ String s = h_selected.getErrorMessage(); >+ if (s != null) { >+ setErrorMessage(s); >+ return false; >+ } >+ >+ setErrorMessage(null); >+ return true; >+ } >+ >+ /** >+ * >+ * @param tree >+ * @param right >+ * @param show_sup >+ * @param ls >+ * @param wizard >+ * @return : selected Wizard Handler. >+ */ >+ public static CWizardHandler updateData(Tree tree, Composite right, Button show_sup, IWizardItemsListListener ls, IWizard wizard) { >+ // remember selected item >+ TreeItem[] sel = tree.getSelection(); >+ String savedStr = (sel.length > 0) ? sel[0].getText() : null; >+ >+ tree.removeAll(); >+ IExtensionPoint extensionPoint = >+ Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); >+ if (extensionPoint == null) return null; >+ IExtension[] extensions = extensionPoint.getExtensions(); >+ if (extensions == null) return null; >+ >+ List<EntryDescriptor> items = new ArrayList<EntryDescriptor>(); >+ for (int i = 0; i < extensions.length; ++i) { >+ IConfigurationElement[] elements = extensions[i].getConfigurationElements(); >+ for (IConfigurationElement element : elements) { >+ if (element.getName().equals(ELEMENT_NAME)) { >+ CNewWizard w = null; >+ try { >+ w = (CNewWizard) element.createExecutableExtension(CLASS_NAME); >+ } catch (CoreException e) { >+ System.out.println(UIMessages.getString("CMainWizardPage.5") + e.getLocalizedMessage()); //$NON-NLS-1$ >+ return null; >+ } >+ if (w == null) return null; >+ w.setDependentControl(right, ls); >+ for (EntryDescriptor ed : w.createItems(show_sup.getSelection(), wizard)) >+ items.add(ed); >+ } >+ } >+ } >+ // If there is a EntryDescriptor which is default for category, make sure it >+ // is in the front of the list. >+ for (int i = 0; i < items.size(); ++i) >+ { >+ EntryDescriptor ed = items.get(i); >+ if (ed.isDefaultForCategory()) >+ { >+ items.remove(i); >+ items.add(0, ed); >+ break; >+ } >+ } >+ >+ // bug # 211935 : allow items filtering. >+ if (ls != null) // NULL means call from prefs >+ items = ls.filterItems(items); >+ addItemsToTree(tree, items); >+ >+ if (tree.getItemCount() > 0) { >+ TreeItem target = null; >+ // try to search item which was selected before >+ if (savedStr != null) { >+ TreeItem[] all = tree.getItems(); >+ for (TreeItem element : all) { >+ if (savedStr.equals(element.getText())) { >+ target = element; >+ break; >+ } >+ } >+ } >+ if (target == null) >+ { >+ target = tree.getItem(0); >+ if (target.getItemCount() != 0) >+ target = target.getItem(0); >+ } >+ tree.setSelection(target); >+ return (CWizardHandler)target.getData(); >+ } >+ return null; >+ } >+ >+ private static void addItemsToTree(Tree tree, List<EntryDescriptor> items) { >+ // Sorting is disabled because of users requests >+ // Collections.sort(items, CDTListComparator.getInstance()); >+ >+ ArrayList<TreeItem> placedTreeItemsList = new ArrayList<TreeItem>(items.size()); >+ ArrayList<EntryDescriptor> placedEntryDescriptorsList = new ArrayList<EntryDescriptor>(items.size()); >+ for (EntryDescriptor wd : items) { >+ if (wd.getParentId() == null) { >+ wd.setPath(wd.getId()); >+ TreeItem ti = new TreeItem(tree, SWT.NONE); >+ ti.setText(TextProcessor.process(wd.getName())); >+ ti.setData(wd.getHandler()); >+ ti.setData(DESC, wd); >+ ti.setImage(calcImage(wd)); >+ placedTreeItemsList.add(ti); >+ placedEntryDescriptorsList.add(wd); >+ } >+ } >+ while(true) { >+ boolean found = false; >+ Iterator<EntryDescriptor> it2 = items.iterator(); >+ while (it2.hasNext()) { >+ EntryDescriptor wd1 = it2.next(); >+ if (wd1.getParentId() == null) continue; >+ for (int i = 0; i< placedEntryDescriptorsList.size(); i++) { >+ EntryDescriptor wd2 = placedEntryDescriptorsList.get(i); >+ if (wd2.getId().equals(wd1.getParentId())) { >+ found = true; >+ wd1.setParentId(null); >+ CWizardHandler h = wd2.getHandler(); >+ /* If neither wd1 itself, nor its parent (wd2) have a handler >+ * associated with them, and the item is not a category, >+ * then skip it. If it's category, then it's possible that >+ * children will have a handler associated with them. >+ */ >+ if (h == null && wd1.getHandler() == null && !wd1.isCategory()) >+ break; >+ >+ wd1.setPath(wd2.getPath() + "/" + wd1.getId()); //$NON-NLS-1$ >+ wd1.setParent(wd2); >+ if (h != null) { >+ if (wd1.getHandler() == null && !wd1.isCategory()) >+ wd1.setHandler((CWizardHandler)h.clone()); >+ if (!h.isApplicable(wd1)) >+ break; >+ } >+ >+ TreeItem p = placedTreeItemsList.get(i); >+ TreeItem ti = new TreeItem(p, SWT.NONE); >+ ti.setText(wd1.getName()); >+ ti.setData(wd1.getHandler()); >+ ti.setData(DESC, wd1); >+ ti.setImage(calcImage(wd1)); >+ placedTreeItemsList.add(ti); >+ placedEntryDescriptorsList.add(wd1); >+ break; >+ } >+ } >+ } >+ // repeat iterations until all items are placed. >+ if (!found) break; >+ } >+ // orphan elements (with not-existing parentId) are ignored >+ } >+ >+ private void switchTo(CWizardHandler h, EntryDescriptor ed) { >+ if (h == null) >+ h = ed.getHandler(); >+ if (ed.isCategory()) >+ h = null; >+ try { >+ if (h != null) >+ h.initialize(ed); >+ } catch (CoreException e) { >+ h = null; >+ } >+ if (h_selected != null) >+ h_selected.handleUnSelection(); >+ h_selected = h; >+ if (h == null) { >+ if (ed.isCategory()) { >+ if (categorySelectedLabel == null) { >+ categorySelectedLabel = new Label(right, SWT.WRAP); >+ categorySelectedLabel.setText( >+ UIMessages.getString("RemoteMainWizardPage.1")); //$NON-NLS-1$ >+ right.layout(); >+ } >+ categorySelectedLabel.setVisible(true); >+ } >+ return; >+ } >+ right_label.setText(h_selected.getHeader()); >+ if (categorySelectedLabel != null) >+ categorySelectedLabel.setVisible(false); >+ h_selected.handleSelection(); >+ h_selected.setSupportedOnly(show_sup.getSelection()); >+ } >+ >+ >+ public static EntryDescriptor getDescriptor(Tree _tree) { >+ TreeItem[] sel = _tree.getSelection(); >+ if (sel == null || sel.length == 0) >+ return null; >+ return (EntryDescriptor)sel[0].getData(DESC); >+ } >+ >+ public void toolChainListChanged(int count) { >+ setPageComplete(validatePage()); >+ getWizard().getContainer().updateButtons(); >+ } >+ >+ public boolean isCurrent() { return isCurrentPage(); } >+ >+ private static Image calcImage(EntryDescriptor ed) { >+ if (ed.getImage() != null) return ed.getImage(); >+ if (ed.isCategory()) return IMG_CATEGORY; >+ return IMG_ITEM; >+ } >+ >+ @SuppressWarnings("unchecked") >+ public List filterItems(List items) { >+ /// iterate through the list, removing entry descriptors we don't care about >+ Iterator iterator = items.iterator(); >+ >+ List<EntryDescriptor> filteredList = new LinkedList<EntryDescriptor>(); >+ >+ while(iterator.hasNext()) { >+ EntryDescriptor ed = (EntryDescriptor) iterator.next(); >+ if(ed.getId().startsWith("org.eclipse.ptp.rdt")) { // both the category and the template start with this //$NON-NLS-1$ >+ filteredList.add(ed); >+ } >+ } >+ >+ return filteredList; >+ } >+ >+// public void pageChanged(PageChangedEvent event) { >+// if (event.getSelectedPage().equals(this)) { >+// if (defaultConfig == null) { >+// ServiceModelManager manager = ServiceModelManager.getInstance(); >+// >+// /* >+// * Create a new service configuration >+// * >+// * XXX: this should check if a service configuration has already >+// * been selected, in which case it should use that one. >+// */ >+// IServiceConfiguration config = manager.newServiceConfiguration(handle.getName()); >+// >+// /* >+// * Make this configuration active for this project. >+// */ >+// manager.setConfiguration(handle, config); >+// >+// /* >+// * Set default service providers based on location of project >+// */ >+// URI location = getLocationURI(); >+// IRemoteServices remServ = PTPRemoteCorePlugin.getDefault().getRemoteServices(location); >+// IRemoteConnection remConn = PTPRemoteCorePlugin.getDefault().getConnection(location); >+// >+// /* >+// * Project location >+// */ >+// IRemoteServiceProvider projectProvider = new RemoteProjectServiceProvider(); >+// projectProvider.setRemoteServicesID(remServ.getId()); >+// projectProvider.setRemoteConnectionName(remConn.getName()); >+// config.setServiceProvider(manager.getService(RemoteProjectServiceProvider.ID), projectProvider); >+// >+// /* >+// * Build service >+// */ >+// IRemoteServiceProvider buildProvider = new RemoteBuildServiceProvider(); >+// buildProvider.setRemoteServicesID(remServ.getId()); >+// buildProvider.setRemoteConnectionName(remConn.getName()); >+// config.setServiceProvider(manager.getService(RemoteBuildServiceProvider.ID), buildProvider); >+// >+// /* >+// * Index service >+// */ >+// IRemoteServiceProvider indexProvider = new RemoteCIndexServiceProvider(); >+// indexProvider.setRemoteServicesID(remServ.getId()); >+// indexProvider.setRemoteConnectionName(remConn.getName()); >+// config.setServiceProvider(manager.getService(RemoteCIndexServiceProvider.ID), indexProvider); >+// >+// defaultConfig = config; >+// >+// /* >+// * Pass configuration to ServiceModelWizardPage >+// */ >+// MBSCustomPageManager.addPageProperty(ServiceModelWizardPage.SERVICE_MODEL_WIZARD_PAGE_ID, >+// ServiceModelWizardPage.SERVICE_CONFIGURATION_PROPERTY, config); >+// } >+// } >+// } >+} >+ >Index: src/org/eclipse/ptp/rdt/ui/newserviceproviders/AbstractRemoteServicesProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newserviceproviders/AbstractRemoteServicesProvider.java >diff -N src/org/eclipse/ptp/rdt/ui/newserviceproviders/AbstractRemoteServicesProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newserviceproviders/AbstractRemoteServicesProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,92 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newserviceproviders; >+ >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteConnectionManager; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+import org.eclipse.ptp.remote.core.PTPRemoteCorePlugin; >+import org.eclipse.ptp.services.core.ServiceProvider; >+ >+/** >+ * A service provider that uses the Remote Services API to provide execution services. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ */ >+public abstract class AbstractRemoteServicesProvider extends ServiceProvider implements IRemoteServiceProvider { >+ >+ public static final String REMOTE_SERVICES_ID = "remoteServicesID"; //$NON-NLS-1$ >+ public static final String REMOTE_CONNECTION_NAME = "remoteConnectionName"; //$NON-NLS-1$ >+ >+ private IRemoteServices fRemoteServices = null; >+ private IRemoteConnection fRemoteConnection = null; >+ >+ public AbstractRemoteServicesProvider() { >+ } >+ >+ public IRemoteConnection getConnection() { >+ if (fRemoteConnection == null) { >+ String connectionName = getString(REMOTE_CONNECTION_NAME); >+ if (connectionName != null) { >+ IRemoteServices services = getRemoteServices(); >+ if (services != null) { >+ IRemoteConnectionManager connMgr = services.getConnectionManager(); >+ if (connMgr != null) { >+ fRemoteConnection = connMgr.getConnection(connectionName); >+ } >+ } >+ } >+ } >+ return fRemoteConnection; >+ } >+ >+ public IRemoteServices getRemoteServices() { >+ if (fRemoteServices == null) { >+ String remoteServicesID = getString(REMOTE_SERVICES_ID); >+ if (remoteServicesID != null) { >+ fRemoteServices = PTPRemoteCorePlugin.getDefault().getRemoteServices(remoteServicesID); >+ } >+ } >+ return fRemoteServices; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.services.core.IServiceProvider#isConfigured() >+ */ >+ public boolean isConfigured() { >+ return (getRemoteServices() != null && getConnection() != null); >+ } >+ >+ /** >+ * Sets the connection that this provider should use for its execution services. >+ * >+ * @param connection >+ */ >+ public void setRemoteConnectionName(String name) { >+ putString(REMOTE_CONNECTION_NAME, name); >+ fRemoteConnection = null; // remove cache >+ } >+ >+ /** >+ * Sets the ID of the Remote Tools provider that this provider should use for its execution services. >+ * >+ * @param id >+ */ >+ public void setRemoteServicesID(String id) { >+ putString(REMOTE_SERVICES_ID, id); >+ fRemoteServices = null; // remove cache >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCIndexServiceProviderConfigurer.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCIndexServiceProviderConfigurer.java >diff -N src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCIndexServiceProviderConfigurer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/newwizards/RemoteCIndexServiceProviderConfigurer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,62 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.newwizards; >+ >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.jface.wizard.IWizardPage; >+import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.ptp.rdt.ui.serviceproviders.RemoteCIndexServiceProvider; >+import org.eclipse.ptp.services.core.IServiceProvider; >+import org.eclipse.ptp.services.ui.IServiceProviderContributor; >+import org.eclipse.ptp.services.ui.wizards.ServiceProviderConfigurationWizard; >+import org.eclipse.swt.widgets.Shell; >+ >+/** >+ * Provides configuration UI for the RemoteCIndexServiceProvider by allowing an RSE >+ * host to be selected. >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ * @author crecoskie >+ * >+ */ >+public class RemoteCIndexServiceProviderConfigurer implements IServiceProviderContributor { >+ >+ /** >+ * >+ */ >+ public RemoteCIndexServiceProviderConfigurer() { >+ // TODO Auto-generated constructor stub >+ } >+ >+ public void configureServiceProvider(IServiceProvider provider, >+ Shell parentShell) { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.IServiceProviderContributor#getWizard(org.eclipse.ptp.services.core.IServiceProvider, org.eclipse.jface.wizard.IWizardPage) >+ */ >+ public IWizard getWizard(IServiceProvider provider, IWizardPage page) { >+ return new ServiceProviderConfigurationWizard(provider, page); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.IServiceProviderContributor#getWizardPages(org.eclipse.ptp.services.core.IServiceProvider) >+ */ >+ public WizardPage[] getWizardPages(IServiceProvider provider) { >+ if (!(provider instanceof RemoteCIndexServiceProvider)) { >+ return new WizardPage[0]; >+ } >+ return new WizardPage[]{new RemoteCIndexConfigurationWizardPage((RemoteCIndexServiceProvider)provider, "Remote C/C++ Indexing Configuration")}; //$NON-NLS-1$ >+ } >+} >#P org.eclipse.ptp.rdt.core >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.core/META-INF/MANIFEST.MF,v >retrieving revision 1.8 >diff -u -r1.8 MANIFEST.MF >--- META-INF/MANIFEST.MF 6 May 2009 12:07:16 -0000 1.8 >+++ META-INF/MANIFEST.MF 14 Jul 2009 12:09:43 -0000 >@@ -14,7 +14,8 @@ > org.eclipse.core.filesystem;bundle-version="1.2.0", > org.eclipse.cdt.managedbuilder.core;bundle-version="5.0.1", > org.eclipse.ptp.remote.core;bundle-version="2.0.1", >- org.eclipse.dstore.extra;bundle-version="2.1.100" >+ org.eclipse.dstore.extra;bundle-version="2.1.100", >+ org.eclipse.ptp.services.core;bundle-version="1.0.0" > Export-Package: org.eclipse.ptp.internal.rdt.core, > org.eclipse.ptp.internal.rdt.core.callhierarchy;x-friends:="org.eclipse.ptp.rdt.ui", > org.eclipse.ptp.internal.rdt.core.contentassist;x-friends:="org.eclipse.ptp.rdt.ui", >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.core/plugin.properties,v >retrieving revision 1.3 >diff -u -r1.3 plugin.properties >--- plugin.properties 13 Feb 2009 17:32:38 -0000 1.3 >+++ plugin.properties 14 Jul 2009 12:09:43 -0000 >@@ -14,6 +14,7 @@ > > remoteIndexer.name = RDT Remote Indexer > CIndexingService.name = C/C++ Indexing >+projectLocationService.name = Project Location > BuildService.name = Build > RemoteMakeBuilder.name = Remote Make Builder > >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.core/plugin.xml,v >retrieving revision 1.5 >diff -u -r1.5 plugin.xml >--- plugin.xml 6 May 2009 12:07:15 -0000 1.5 >+++ plugin.xml 14 Jul 2009 12:09:43 -0000 >@@ -87,4 +87,34 @@ > </run> > </runtime> > </extension> >+ <extension >+ point="org.eclipse.ptp.services.core.services"> >+ <service >+ id="org.eclipse.ptp.rdt.core.CIndexingService" >+ name="%CIndexingService.name" >+ priority="100"> >+ <nature >+ id="org.eclipse.cdt.core.cnature"> >+ </nature> >+ <nature >+ id="org.eclipse.cdt.core.ccnature"> >+ </nature> >+ </service> >+ <service >+ id="org.eclipse.ptp.rdt.core.BuildService" >+ name="%BuildService.name" >+ priority="200"> >+ <nature >+ id="org.eclipse.cdt.core.cnature"> >+ </nature> >+ <nature >+ id="org.eclipse.cdt.core.ccnature"> >+ </nature> >+ </service> >+ <service >+ id="org.eclipse.ptp.rdt.core.ProjectLocationService" >+ name="%projectLocationService.name" >+ priority="10"> >+ </service> >+ </extension> > </plugin> >Index: src/org/eclipse/ptp/rdt/core/services/IRDTServiceConstants.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/services/IRDTServiceConstants.java,v >retrieving revision 1.2 >diff -u -r1.2 IRDTServiceConstants.java >--- src/org/eclipse/ptp/rdt/core/services/IRDTServiceConstants.java 23 Sep 2008 19:58:45 -0000 1.2 >+++ src/org/eclipse/ptp/rdt/core/services/IRDTServiceConstants.java 14 Jul 2009 12:09:43 -0000 >@@ -23,4 +23,5 @@ > public interface IRDTServiceConstants { > public static final String SERVICE_C_INDEX = "org.eclipse.ptp.rdt.core.CIndexingService"; //$NON-NLS-1$ > public static final String SERVICE_BUILD = "org.eclipse.ptp.rdt.core.BuildService"; //$NON-NLS-1$ >+ public static final String SERVICE_PROJECT = "org.eclipse.ptp.rdt.core.ProjectLocationService"; //$NON-NLS-1$ > } >Index: src/org/eclipse/ptp/rdt/core/serviceproviders/IProjectLocationServiceProvider.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/core/serviceproviders/IProjectLocationServiceProvider.java >diff -N src/org/eclipse/ptp/rdt/core/serviceproviders/IProjectLocationServiceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/core/serviceproviders/IProjectLocationServiceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.core.serviceproviders; >+ >+import java.net.URI; >+ >+ >+/** >+ * Project location service provider interface. >+ * >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the RDT team. >+ * >+ */ >+public interface IProjectLocationServiceProvider extends IRemoteExecutionServiceProvider { >+ /** >+ * @return >+ */ >+ public boolean isLocal(); >+ >+ /** >+ * @return >+ */ >+ public URI getProjectLocationURI(); >+}
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 283402
: 141504 |
141505
|
148169
|
151066