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 151073 Details for
Bug 293929
Add Remote Tools remote indexing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to add remote tools indexing support
rdt_remote_tools.patch (text/plain), 266.93 KB, created by
Greg Watson
on 2009-11-02 09:46:46 EST
(
hide
)
Description:
Patch to add remote tools indexing support
Filename:
MIME Type:
Creator:
Greg Watson
Created:
2009-11-02 09:46:46 EST
Size:
266.93 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ptp.rdt.ui >Index: src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWizardPageOperation.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWizardPageOperation.java,v >retrieving revision 1.9 >diff -u -r1.9 ServiceModelWizardPageOperation.java >--- src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWizardPageOperation.java 29 Oct 2009 21:00:23 -0000 1.9 >+++ src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWizardPageOperation.java 2 Nov 2009 14:33:52 -0000 >@@ -10,7 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ptp.rdt.ui.wizards; > >-import static org.eclipse.ptp.rdt.ui.wizards.ServiceModelWizardPage.SERVICE_MODEL_WIDGET_PROPERTY; >+import static org.eclipse.ptp.rdt.ui.wizards.ServiceModelWizardPage.CONFIG_PROPERTY; > > import java.io.IOException; > import java.lang.reflect.InvocationTargetException; >@@ -18,8 +18,8 @@ > 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.ui.wizards.ICDTCommonProjectWizard; > import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager; >-import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.jface.operation.IRunnableWithProgress; >@@ -27,7 +27,6 @@ > import org.eclipse.ptp.internal.rdt.core.index.RemoteFastIndexer; > import org.eclipse.ptp.services.core.IServiceConfiguration; > import org.eclipse.ptp.services.core.ServiceModelManager; >-import org.eclipse.ptp.services.ui.widgets.ServiceProviderConfigurationWidget; > import org.eclipse.rse.internal.connectorservice.dstore.Activator; > > /** >@@ -38,30 +37,19 @@ > * 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) >- */ >+ > public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >- monitor.beginTask("configure model services", 100); //$NON-NLS-1$ >- >+ monitor.beginTask("configure model services", 100); //$NON-NLS-1$ >+ > IWizard wizard = MBSCustomPageManager.getPageData(ServiceModelWizardPage.SERVICE_MODEL_WIZARD_PAGE_ID).getWizardPage().getWizard(); >- IProject project = ((CDTCommonProjectWizard) wizard).getLastProject(); >+ IProject project = ((ICDTCommonProjectWizard) wizard).getLastProject(); > >- ServiceProviderConfigurationWidget widget = (ServiceProviderConfigurationWidget)getMBSProperty(SERVICE_MODEL_WIDGET_PROPERTY); >- widget.applyChangesToConfiguration(); >- IServiceConfiguration config = widget.getServiceConfiguration(); >+ IServiceConfiguration config = (IServiceConfiguration)getMBSProperty(CONFIG_PROPERTY); > > ServiceModelManager smm = ServiceModelManager.getInstance(); > smm.addConfiguration(project, config); >Index: src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteCppProjectWizard.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteCppProjectWizard.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteCppProjectWizard.java >--- src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteCppProjectWizard.java 18 Nov 2008 16:40:37 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,96 +0,0 @@ >-/******************************************************************************* >- * 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.wizards; >- >-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.cdt.ui.wizards.CDTMainWizardPage; >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.NullProgressMonitor; >-import org.eclipse.jface.resource.ImageDescriptor; >-import org.eclipse.ptp.internal.rdt.ui.RDTPluginImages; >-import org.eclipse.ptp.rdt.core.resources.RemoteNature; >-import org.eclipse.ptp.rdt.ui.messages.Messages; >-import org.eclipse.swt.widgets.Composite; >- >-/** >- * 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 NewRemoteCppProjectWizard extends CDTCommonProjectWizard { >- private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$ >- private static final String wz_title = Messages.getString("NewRemoteCppProjectWizard_0"); //$NON-NLS-1$ >- private static final String wz_desc = Messages.getString("NewRemoteCppProjectWizard_1"); //$NON-NLS-1$ >- >- /** >- * >- */ >- public NewRemoteCppProjectWizard() { >- >- 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/wizards/RDTMainWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/RDTMainWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/RDTMainWizardPage.java >--- src/org/eclipse/ptp/rdt/ui/wizards/RDTMainWizardPage.java 4 Jun 2009 19:47:08 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,71 +0,0 @@ >-/******************************************************************************* >- * 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.wizards; >- >-import java.util.Iterator; >-import java.util.LinkedList; >-import java.util.List; >- >-import org.eclipse.cdt.ui.newui.CDTPrefUtil; >-import org.eclipse.cdt.ui.wizards.CDTMainWizardPage; >-import org.eclipse.cdt.ui.wizards.EntryDescriptor; >-import org.eclipse.jface.wizard.IWizardPage; >-import org.eclipse.ptp.internal.rdt.ui.RDTHelpContextIds; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Shell; >-import org.eclipse.ui.PlatformUI; >- >-/** >- * Main page of the RDT wizard, which filters out local project types. >- * >- * <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 RDTMainWizardPage extends CDTMainWizardPage { >- >- public RDTMainWizardPage(String pageName) { >- super(pageName); >- >- // default to view all toolchains >- CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSUPP, true); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.cdt.ui.wizards.IWizardItemsListListener#filterItems(java.util.List) >- */ >- @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 createControl(Composite parent){ >- super.createControl(parent); >- Shell shell = getContainer().getShell(); //if not created on the shell, will not display properly >- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, RDTHelpContextIds.CREATING_A_REMOTE_PROJECT); >- } >- >-} >Index: src/org/eclipse/ptp/rdt/ui/wizards/RemoteServicesProviderSelectionDialog.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/RemoteServicesProviderSelectionDialog.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/RemoteServicesProviderSelectionDialog.java >--- src/org/eclipse/ptp/rdt/ui/wizards/RemoteServicesProviderSelectionDialog.java 1 Sep 2009 15:52:38 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,270 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008, 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 - Initial API and implementation >- *******************************************************************************/ >-package org.eclipse.ptp.rdt.ui.wizards; >- >-import java.util.HashMap; >-import java.util.Map; >- >-import org.eclipse.jface.dialogs.Dialog; >-import org.eclipse.jface.dialogs.IDialogConstants; >-import org.eclipse.ptp.rdt.ui.messages.Messages; >-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.ui.IRemoteUIConnectionManager; >-import org.eclipse.ptp.remote.ui.PTPRemoteUIPlugin; >-import org.eclipse.ptp.services.core.IServiceProvider; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.SelectionEvent; >-import org.eclipse.swt.events.SelectionListener; >-import org.eclipse.swt.graphics.Point; >-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.Label; >-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 RemoteServicesProviderSelectionDialog extends Dialog { >- >- >- 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; >- >- public RemoteServicesProviderSelectionDialog(IServiceProvider provider, Shell parentShell) { >- super(parentShell); >- >- if(provider instanceof RemoteBuildServiceProvider) >- fProvider = (RemoteBuildServiceProvider) provider; >- else >- throw new IllegalArgumentException(); // should never happen >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) >- */ >- protected Control createDialogArea(Composite parent) { >- Composite container = (Composite) super.createDialogArea(parent); >- >- getShell().setText(Messages.getString("RemoteServicesProviderSelectionDialog_0")); //$NON-NLS-1$ >- >- GridLayout layout = new GridLayout(); >- layout.numColumns = 5; >- container.setLayout(layout); >- >- // 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 >- providerCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false)); >- >- //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); >- >- } >- >- }); >- >- 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); >- } >- >- }); >- >- >- return container; >- } >- >- >- private void updateNewConnectionButtonEnabled(Button button) { >- IRemoteUIConnectionManager connectionManager = getUIConnectionManager(); >- button.setEnabled(connectionManager != null); >- } >- >- /** >- * @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); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) >- */ >- protected void createButtonsForButtonBar(Composite parent) { >- createButton(parent, IDialogConstants.OK_ID, >- IDialogConstants.OK_LABEL, true); >- createButton(parent, IDialogConstants.CANCEL_ID, >- IDialogConstants.CANCEL_LABEL, false); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.Dialog#isResizable() >- */ >- @Override >- protected boolean isResizable() { >- return true; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.Dialog#getInitialSize() >- */ >- protected Point getInitialSize() { >- return new Point(750, 125); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.Dialog#okPressed() >- */ >- @Override >- protected void okPressed() { >- super.okPressed(); >- >- // set the provider >- fProvider.setRemoteToolsProviderID(fSelectedProvider.getId()); >- fProvider.setRemoteToolsConnection(fSelectedConnection); >- >- } >- >- >-} >Index: src/org/eclipse/ptp/rdt/ui/wizards/RemoteServicesServiceProviderConfigurer.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/RemoteServicesServiceProviderConfigurer.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/RemoteServicesServiceProviderConfigurer.java >--- src/org/eclipse/ptp/rdt/ui/wizards/RemoteServicesServiceProviderConfigurer.java 17 Sep 2009 15:51:49 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,38 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008, 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 - Initial API and implementation >- *******************************************************************************/ >-package org.eclipse.ptp.rdt.ui.wizards; >- >-import org.eclipse.jface.dialogs.Dialog; >-import org.eclipse.ptp.services.core.IServiceProvider; >-import org.eclipse.ptp.services.ui.IServiceProviderConfiguration; >-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 >- * @deprecated >- */ >-public class RemoteServicesServiceProviderConfigurer implements IServiceProviderConfiguration { >- >- >- public void configureServiceProvider(IServiceProvider provider, Shell parentShell) { >- Dialog configDialog = new RemoteServicesProviderSelectionDialog(provider, parentShell); >- configDialog.open(); >- } >- >-} >Index: src/org/eclipse/ptp/rdt/ui/wizards/HostSelectionDialog.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/HostSelectionDialog.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/HostSelectionDialog.java >--- src/org/eclipse/ptp/rdt/ui/wizards/HostSelectionDialog.java 1 Sep 2009 15:52:38 -0000 1.8 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,212 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008, 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 - Initial API and implementation >- *******************************************************************************/ >-package org.eclipse.ptp.rdt.ui.wizards; >- >-import java.util.HashMap; >-import java.util.Map; >- >-import org.eclipse.jface.dialogs.Dialog; >-import org.eclipse.jface.dialogs.IDialogConstants; >-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.core.IServiceProvider; >-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.graphics.Point; >-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.Label; >-import org.eclipse.swt.widgets.Shell; >- >-/** >- * Provides a dialog which allows you to select an RSE host for the 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 >- * >- */ >-public class HostSelectionDialog extends Dialog { >- >- private RemoteCIndexServiceProvider fProvider; >- >- private Map<Integer, IHost> fHostComboIndexToHostMap = new HashMap<Integer, IHost>(); >- >- private IHost fSelectedHost; >- private String configPath; >- >- public HostSelectionDialog(IServiceProvider provider, Shell parentShell) { >- super(parentShell); >- >- if(provider instanceof RemoteCIndexServiceProvider) >- fProvider = (RemoteCIndexServiceProvider) provider; >- else >- throw new IllegalArgumentException(); // should never happen >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) >- */ >- protected Control createDialogArea(Composite parent) { >- Composite container = (Composite) super.createDialogArea(parent); >- getShell().setText(Messages.getString("HostSelectionDialog.1")); //$NON-NLS-1$ >- >- GridLayout layout = new GridLayout(); >- layout.numColumns = 3; >- container.setLayout(layout); >- >- // 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); >- hostCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); // set layout to grab horizontal space >- >- //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); >- >- >- >- // 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; >- } >- } >- >- }); >- >- configPath = fProvider.getIndexLocation(); >- if(fProvider.isConfigured() && configPath == null) // happens if the project was created before the index location feature was added >- configPath = ""; //$NON-NLS-1$ >- >- final IndexFileLocationWidget scopeWidget = new IndexFileLocationWidget(container, SWT.NONE, fSelectedHost, configPath); >- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); >- data.horizontalSpan = 3; >- scopeWidget.setLayoutData(data); // set layout to grab horizontal space >- scopeWidget.addPathListener(new IIndexFilePathChangeListener() { >- public void pathChanged(String newPath) { >- configPath = newPath; >- } >- }); >- >- >- hostCombo.addSelectionListener(new SelectionListener() { >- public void widgetDefaultSelected(SelectionEvent e) { >- widgetSelected(e); >- } >- >- public void widgetSelected(SelectionEvent e) { >- int selectionIndex = hostCombo.getSelectionIndex(); >- fSelectedHost = fHostComboIndexToHostMap.get(selectionIndex); >- scopeWidget.setHost(fSelectedHost); >- } >- }); >- >- return container; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) >- */ >- protected void createButtonsForButtonBar(Composite parent) { >- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); >- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.Dialog#getInitialSize() >- */ >- protected Point getInitialSize() { >- return new Point(500,300); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.dialogs.Dialog#okPressed() >- */ >- @Override >- protected void okPressed() { >- super.okPressed(); >- >- // set the host for the service provider >- fProvider.setConnection(fSelectedHost, getDStoreConnectorService(fSelectedHost)); >- fProvider.setIndexLocation(configPath); >- fProvider.setConfigured(true); >- } >- >- 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/wizards/ConvertToRemoteWizardPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/ConvertToRemoteWizardPage.java,v >retrieving revision 1.9 >diff -u -r1.9 ConvertToRemoteWizardPage.java >--- src/org/eclipse/ptp/rdt/ui/wizards/ConvertToRemoteWizardPage.java 1 Sep 2009 15:52:38 -0000 1.9 >+++ src/org/eclipse/ptp/rdt/ui/wizards/ConvertToRemoteWizardPage.java 2 Nov 2009 14:33:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008, 2009 IBM Corporation and others. >+ * 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 >@@ -11,8 +11,11 @@ > > package org.eclipse.ptp.rdt.ui.wizards; > >+ >+import java.io.IOException; > import java.lang.reflect.InvocationTargetException; > import java.text.MessageFormat; >+import java.util.HashMap; > import java.util.Map; > > import org.eclipse.cdt.ui.wizards.conversion.ConvertProjectWizardPage; >@@ -25,11 +28,16 @@ > import org.eclipse.jface.viewers.ISelectionChangedListener; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.SelectionChangedEvent; >-import org.eclipse.ptp.internal.rdt.ui.RDTHelpContextIds; > import org.eclipse.ptp.rdt.core.RDTLog; > import org.eclipse.ptp.rdt.core.resources.RemoteNature; >-import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.services.core.IServiceConfiguration; >+import org.eclipse.ptp.services.core.IServiceModelManager; > import org.eclipse.ptp.services.core.IServiceProvider; >+import org.eclipse.ptp.services.core.ServiceModelManager; >+import org.eclipse.ptp.services.ui.widgets.ServiceProviderConfigurationWidget; >+ >+import org.eclipse.ptp.rdt.ui.UIPlugin; >+import org.eclipse.ptp.rdt.ui.messages.Messages; > import org.eclipse.swt.SWT; > import org.eclipse.swt.layout.FillLayout; > import org.eclipse.swt.layout.GridData; >@@ -37,8 +45,6 @@ > import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Group; > import org.eclipse.swt.widgets.Listener; >-import org.eclipse.swt.widgets.Shell; >-import org.eclipse.ui.PlatformUI; > > /** > * Converts existing CDT projects to RDT projects. >@@ -54,21 +60,17 @@ > > private static final String WZ_TITLE = "WizardProjectConversion.title"; //$NON-NLS-1$ > private static final String WZ_DESC = "WizardProjectConversion.description"; //$NON-NLS-1$ >- ConvertToRemoteServiceModelWidget fServiceModelWidget; >+ ServiceProviderConfigurationWidget fServiceModelWidget; > Group remoteServices; > >+ Map<IProject, IServiceConfiguration> projectConfigs = new HashMap<IProject, IServiceConfiguration>(); >+ > /** > * Constructor for ConvertToRemoteWizardPage. > * @param pageName > */ > public ConvertToRemoteWizardPage(String pageName) { > super(pageName); >- fServiceModelWidget = new ConvertToRemoteServiceModelWidget(); >- fServiceModelWidget.setConfigChangeListener(new Listener() { >- public void handleEvent(Event event) { >- setPageComplete(validatePage()); >- } >- }); > } > > /** >@@ -102,7 +104,7 @@ > b = !project.hasNature(RemoteNature.REMOTE_NATURE_ID); > c = !project.hasNature("org.eclipse.rse.ui.remoteSystemsTempNature"); //$NON-NLS-1$ > } catch (CoreException e) { >- RDTLog.logError(e); >+ RDTLog.logError(e); > } > return a && b && c; > } >@@ -116,9 +118,9 @@ > RemoteNature.addRemoteNature(project, monitor); > configureServicesForRemoteProject(project); > } catch (InvocationTargetException e) { >- RDTLog.logError(e); >+ RDTLog.logError(e); > } catch (InterruptedException e) { >- RDTLog.logError(e); >+ RDTLog.logError(e); > } finally { > monitor.done(); > } >@@ -134,9 +136,9 @@ > RemoteNature.addRemoteNature(project, monitor); > configureServicesForRemoteProject(project); > } catch (InvocationTargetException e) { >- RDTLog.logError(e); >+ RDTLog.logError(e); > } catch (InterruptedException e) { >- RDTLog.logError(e); >+ RDTLog.logError(e); > } finally { > monitor.done(); > } >@@ -147,23 +149,17 @@ > remoteServices = new Group(container, SWT.SHADOW_IN); > remoteServices.setText(Messages.getString("WizardProjectConversion.servicesTableLabel")); //$NON-NLS-1$ > remoteServices.setLayout(new FillLayout()); >- remoteServices.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); >+ data.heightHint = 300; >+ remoteServices.setLayoutData(data); > >- //create the table for remote services >- fServiceModelWidget.createContents(remoteServices); >- //remove all the services in the table for now and add them back as project gets selected in the project list >- fServiceModelWidget.emptyTable(); >- } >- >- public void createControl(Composite parent) { >- super.createControl(parent); >+ >+ fServiceModelWidget = new ServiceProviderConfigurationWidget(remoteServices, SWT.NONE); > tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { > public void selectionChanged(SelectionChangedEvent e) { > IProject project = (IProject) ((IStructuredSelection)e.getSelection()).getFirstElement(); > if (project != null) { >- //update the table with remote services available for the project selected >- fServiceModelWidget.addServicesToTable(project); >- remoteServices.setText(MessageFormat.format(Messages.getString("WizardProjectConversion.servicesTableForProjectLabel"), new Object[] {project.getName()})); //$NON-NLS-1$ >+ changeProject(project); > } > } > }); >@@ -171,32 +167,52 @@ > public void checkStateChanged(CheckStateChangedEvent e) { > IProject project = (IProject) e.getElement(); > if (e.getChecked() && project != null) { >- //update the table with remote services available for the project selected >- fServiceModelWidget.addServicesToTable(project); >- remoteServices.setText(MessageFormat.format(Messages.getString("WizardProjectConversion.servicesTableForProjectLabel"), new Object[] {project.getName()})); //$NON-NLS-1$ >+ changeProject(project); > } > } > }); >- Shell shell = getContainer().getShell(); >- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,RDTHelpContextIds.CONVERTING_TO_REMOTE_PROJECT); >- } >- >- private void configureServicesForRemoteProject(IProject project) throws InvocationTargetException, >- InterruptedException { >- Map<IProject, Map<String,String>> projectToServices = fServiceModelWidget.getProjectToServices(); >- Map<IProject, Map<String,IServiceProvider>> projectToProviders = fServiceModelWidget.getProjectToProviders(); > >- Map<String, String> serviceIDToProviderIDMap = projectToServices.get(project); >- Map<String, IServiceProvider> providerIDToProviderMap = projectToProviders.get(project); > >- ConfigureRemoteServices.configure(project, serviceIDToProviderIDMap, providerIDToProviderMap, new NullProgressMonitor()); > } > >- /* (non-Javadoc) >- * @see org.eclipse.cdt.ui.wizards.conversion.ConvertProjectWizardPage#validatePage() >- */ >+ > @Override >- protected boolean validatePage() { >- return super.validatePage() && fServiceModelWidget.isConfigured(getCheckedElements()); >+ public void doRun(IProgressMonitor monitor, String projectID, String bsId)throws CoreException { >+ fServiceModelWidget.applyChangesToConfiguration(); >+ super.doRun(monitor, projectID, bsId); >+ try { >+ ServiceModelManager.getInstance().saveModelConfiguration(); >+ } catch (IOException e) { >+ UIPlugin.log(e); >+ } > } >+ >+ >+ private IServiceConfiguration getConfig(IProject project) { >+ IServiceConfiguration config = projectConfigs.get(project); >+ if(config == null) { >+ config = ServiceModelManager.getInstance().newServiceConfiguration(project.getName()); >+ projectConfigs.put(project, config); >+ } >+ return config; >+ } >+ >+ >+ private void changeProject(IProject project) { >+ IServiceConfiguration config = getConfig(project); >+ fServiceModelWidget.applyChangesToConfiguration(); >+ fServiceModelWidget.setServiceConfiguration(config); >+ remoteServices.setText(MessageFormat.format(Messages.getString("WizardProjectConversion.servicesTableForProjectLabel"), new Object[] {project.getName()})); //$NON-NLS-1$ >+ setPageComplete(true); >+ } >+ >+ >+ >+ >+ private void configureServicesForRemoteProject(IProject project) throws InvocationTargetException, InterruptedException { >+ ServiceModelManager.getInstance().addConfiguration(project, getConfig(project)); >+ } >+ >+ >+ > } >Index: src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWidget.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWidget.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWidget.java >--- src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWidget.java 17 Sep 2009 15:51:49 -0000 1.10 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,459 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008, 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 >- *******************************************************************************/ >- >-package org.eclipse.ptp.rdt.ui.wizards; >- >-import java.util.HashMap; >-import java.util.Iterator; >-import java.util.LinkedHashSet; >-import java.util.LinkedList; >-import java.util.List; >-import java.util.Map; >-import java.util.Set; >- >-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.jface.layout.TableColumnLayout; >-import org.eclipse.jface.viewers.ColumnWeightData; >-import org.eclipse.ptp.rdt.core.RDTLog; >-import org.eclipse.ptp.rdt.ui.messages.Messages; >-import org.eclipse.ptp.rdt.ui.serviceproviders.NullBuildServiceProvider; >-import org.eclipse.ptp.rdt.ui.serviceproviders.NullCIndexServiceProvider; >-import org.eclipse.ptp.services.core.IService; >-import org.eclipse.ptp.services.core.IServiceProvider; >-import org.eclipse.ptp.services.core.IServiceProviderDescriptor; >-import org.eclipse.ptp.services.core.ServiceModelManager; >-import org.eclipse.ptp.services.ui.IServiceProviderConfiguration; >-import org.eclipse.ptp.services.ui.IServiceProviderContributor; >-import org.eclipse.ptp.services.ui.ServiceModelUIManager; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.custom.CCombo; >-import org.eclipse.swt.custom.TableEditor; >-import org.eclipse.swt.layout.FillLayout; >-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.Control; >-import org.eclipse.swt.widgets.Event; >-import org.eclipse.swt.widgets.Listener; >-import org.eclipse.swt.widgets.Table; >-import org.eclipse.swt.widgets.TableColumn; >-import org.eclipse.swt.widgets.TableItem; >- >-/** >- * <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. >- * >- * @deprecated >- * @see org.eclipse.ptp.services.ui.wizards.ServiceModelWidget >- */ >-public class ServiceModelWidget{ >- >- protected static final String PROVIDER_KEY = "provider-id"; //$NON-NLS-1$ >- protected static final String SERVICE_KEY = "service-id"; //$NON-NLS-1$ >- >- protected Map<String, String> fServiceIDToSelectedProviderID; >- protected Map<String, IServiceProvider> fProviderIDToProviderMap; >- >- protected Table fTable; >- protected Button fConfigureButton; >- protected Listener fConfigChangeListener = null; >- >- public ServiceModelWidget() { >- fServiceIDToSelectedProviderID = new HashMap<String, String>(); >- fProviderIDToProviderMap = new HashMap<String, IServiceProvider>(); >- } >- >- public Control createContents(Composite parent) { >- Composite canvas = new Composite(parent, SWT.NONE); >- GridLayout canvasLayout = new GridLayout(2, false); >- canvas.setLayout(canvasLayout); >- >- Composite tableParent = new Composite(canvas, SWT.NONE); >- tableParent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >- >- fTable = new Table (tableParent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL); >- fTable.setLinesVisible (true); >- fTable.setHeaderVisible (true); >- >- TableColumnLayout layout = new TableColumnLayout(); >- // create the columns and headers... note fourth column holds "Configure..." buttons and hence has no title. >- String[] titles = {Messages.getString("ServiceModelWidget.0"), Messages.getString("ServiceModelWidget.1"), Messages.getString("ServiceModelWidget.3")}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- for (int i=0; i<titles.length; i++) { >- TableColumn column = new TableColumn (fTable, SWT.NONE); >- column.setText (titles [i]); >- int width = ColumnWeightData.MINIMUM_WIDTH; >- >- // set the column widths >- switch (i) { >- case 0: // Service name... usually short >- width = 100; >- break; >- >- case 1: // provider name... typically long >- case 2: // configuration string... typically long >- width = 250; >- break; >- >- } >- >- layout.setColumnData(column, new ColumnWeightData(1, width, true)); >- >- >- } >- tableParent.setLayout(layout); >- fTable.setLayout(new FillLayout()); >- >- createTableContent(null); >- >- fTable.setVisible(true); >- >- final TableEditor editor = new TableEditor(fTable); >- editor.horizontalAlignment = SWT.BEGINNING; >- editor.grabHorizontal = true; >- fTable.addListener(SWT.Selection, new Listener() { >- public void handleEvent(Event event) { >- int selectionIndex = fTable.getSelectionIndex(); >- if (selectionIndex == -1) { >- fConfigureButton.setEnabled(false); >- return; >- } >- final TableItem item = fTable.getItem(selectionIndex); >- IService service = (IService) item.getData(SERVICE_KEY); >- IServiceProviderDescriptor provider = (IServiceProviderDescriptor) item.getData(PROVIDER_KEY); >- >- updateConfigureButton(provider); >- >- final CCombo combo = new CCombo(fTable, SWT.READ_ONLY); >- >- // populate with list of providers >- Set<IServiceProviderDescriptor> providers = service.getProviders(); >- Iterator<IServiceProviderDescriptor> providerIterator = providers.iterator(); >- >- int index = 0; >- final List<IServiceProviderDescriptor> providerIds = new LinkedList<IServiceProviderDescriptor>(); >- while(providerIterator.hasNext()) { >- IServiceProviderDescriptor descriptor = providerIterator.next(); >- combo.add(descriptor.getName(), index); >- providerIds.add(descriptor); >- if (descriptor.equals(provider)) { >- combo.select(index); >- } >- ++index; >- } >- >- combo.setFocus(); >- Listener listener = new Listener() { >- public void handleEvent(Event event) { >- switch (event.type) { >- case SWT.FocusOut: >- combo.dispose(); >- break; >- case SWT.Selection: >- int selection = combo.getSelectionIndex(); >- if (selection == -1) { >- return; >- } >- IServiceProviderDescriptor descriptor = providerIds.get(selection); >- item.setText(1, descriptor.getName()); >- IService service = (IService) item.getData(SERVICE_KEY); >- item.setData(PROVIDER_KEY, descriptor); >- >- updateConfigureButton(descriptor); >- >- //look in cache to see if there is a service provider that is already setup >- IServiceProvider provider = fProviderIDToProviderMap.get(descriptor.getId()); >- String configString = Messages.getString("ServiceModelWidget.4"); //$NON-NLS-1$ >- if (provider != null) { //a service provider was already setup >- configString = provider.getConfigurationString(); >- } >- >- item.setText(2, configString); >- >- if (descriptor.getId().compareTo(NullBuildServiceProvider.ID) == 0 || >- descriptor.getId().compareTo(NullCIndexServiceProvider.ID) == 0) { >- >- //since the null providers are chosen, setup the service provider and the mappings >- ServiceModelManager manager = ServiceModelManager.getInstance(); >- IServiceProvider serviceProvider = manager.getServiceProvider(descriptor); >- >- configString = serviceProvider.getConfigurationString(); >- if (configString == null) { >- configString = Messages.getString("ServiceModelWidget.4"); //$NON-NLS-1$ >- } >- item.setText(2, configString); >- fProviderIDToProviderMap.put(descriptor.getId(), serviceProvider); >- } >- >- fServiceIDToSelectedProviderID.put(service.getId(), descriptor.getId()); >- >- // allow container page to check if configurations are set >- if (fConfigChangeListener != null) >- fConfigChangeListener.handleEvent(null); >- >- combo.dispose(); >- break; >- } >- } >- }; >- combo.addListener(SWT.FocusOut, listener); >- combo.addListener(SWT.Selection, listener); >- >- editor.setEditor(combo, item, 1); >- } >- }); >- >- fConfigureButton = new Button(canvas, SWT.PUSH); >- fConfigureButton.setEnabled(false); >- fConfigureButton.setText(Messages.getString("ServiceModelWidget.2")); //$NON-NLS-1$ >- fConfigureButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false)); >- Listener configureListener = getConfigureListener(); >- fConfigureButton.addListener(SWT.Selection, configureListener); >- return canvas; >- } >- >- public class ConfigureListener implements Listener { >- public void handleEvent(Event event) { >- // launch the configuration UI for the service provider >- TableItem[] selection = fTable.getSelection(); >- if (selection.length == 0) { >- return; >- } >- TableItem item = selection[0]; >- ServiceModelManager manager = ServiceModelManager.getInstance(); >- IServiceProviderDescriptor descriptor = (IServiceProviderDescriptor) item.getData(PROVIDER_KEY); >- >- //look in cache first >- IServiceProvider serviceProvider = fProviderIDToProviderMap.get(descriptor.getId()); >- >- if (serviceProvider == null) { >- serviceProvider = manager.getServiceProvider(descriptor); >- fProviderIDToProviderMap.put(descriptor.getId(), serviceProvider); >- } >- >- IServiceProviderConfiguration configUI = ServiceModelUIManager.getInstance().getServiceProviderConfigurationUI(serviceProvider); >- configUI.configureServiceProvider(serviceProvider, fConfigureButton.getShell()); >- >- String configString = serviceProvider.getConfigurationString(); >- // column 2 holds the configuration string of the provider's current configuration >- if (configString == null) { >- configString = Messages.getString("ServiceModelWidget.4"); //$NON-NLS-1$ >- } >- item.setText(2, configString); >- >- // allow container page to check if configurations are set >- if (fConfigChangeListener != null) >- fConfigChangeListener.handleEvent(null); >- } >- } >- >- //sub class may override to change behaviour >- protected Listener getConfigureListener() { >- return new ConfigureListener(); >- } >- >- /** >- * Generate the services, providers and provider configuration available for >- * the given project in the table >- * >- * Sub-classes may override its behaviour >- * @param project >- */ >- protected void createTableContent(IProject project) { >- fTable.removeAll(); >- Set<IService> allApplicableServices = getContributedServices(project); >- >- Iterator<IService> iterator = allApplicableServices.iterator(); >- >- // get the contributed services... we need one row for each >- while(iterator.hasNext()) { >- final IService service = iterator.next(); >- >- TableItem item = new TableItem (fTable, SWT.NONE); >- >- // column 0 lists the name of the service >- item.setText (0, service.getName()); >- item.setData(SERVICE_KEY, service); >- >- // column 1 holds a dropdown with a list of providers >- // default entry is the null provider if there is one >- IServiceProviderDescriptor descriptor; >-// if (service.getId().compareTo(NullBuildServiceProvider.SERVICE_ID) == 0) >-// descriptor = service.getProviderDescriptor(NullBuildServiceProvider.ID); >-// else if (service.getId().compareTo(NullCIndexServiceProvider.SERVICE_ID) == 0) >-// descriptor = service.getProviderDescriptor(NullCIndexServiceProvider.ID); >-// else >- descriptor = service.getProviders().iterator().next(); >- item.setText(1, descriptor.getName()); >- item.setData(PROVIDER_KEY, descriptor); >- >- // No actual providers are created yet so there's no configuration >- String configString = Messages.getString("ServiceModelWidget.4"); //$NON-NLS-1$ >- >- if (descriptor.getId().compareTo(NullBuildServiceProvider.ID) == 0 || >- descriptor.getId().compareTo(NullCIndexServiceProvider.ID) == 0) { >- >- //since the null providers are chosen, setup the service provider and the mappings >- ServiceModelManager manager = ServiceModelManager.getInstance(); >- IServiceProvider serviceProvider = manager.getServiceProvider(descriptor); >- >- configString = serviceProvider.getConfigurationString(); >- if (configString == null) { >- configString = Messages.getString("ServiceModelWidget.4"); //$NON-NLS-1$ >- } >- >- fProviderIDToProviderMap.put(descriptor.getId(), serviceProvider); >- } >- >- // column 2 holds the configuration string of the provider's current configuration >- item.setText(2, configString); >- >- fServiceIDToSelectedProviderID.put(service.getId(), descriptor.getId()); >- >- // allow container page to check if configurations are set >- if (fConfigChangeListener != null) >- fConfigChangeListener.handleEvent(null); >- } >- } >- >- /** >- * Find available remote services and service providers for a given project >- * >- * If project is null, the C and C++ natures are used to determine which services >- * are available >- */ >- protected Set<IService> getContributedServices(IProject project) { >- ServiceModelManager modelManager = ServiceModelManager.getInstance(); >- Set<IService> allApplicableServices = new LinkedHashSet<IService>(); >- >- if (project != null) { >- >- String[] natureIds = new String[] {}; >- try { >- //get the project natures of the project >- natureIds = project.getDescription().getNatureIds(); >- } catch (CoreException e) { >- RDTLog.logError(e); >- } >- >- for (int i = 0; i < natureIds.length; i++) { >- String natureId = natureIds[i]; >- Set<IService> services = modelManager.getServices(natureId); >- if (services != null) >- allApplicableServices.addAll(services); >- } >- } >- else { >- Set<IService> cppServices = modelManager.getServices(CCProjectNature.CC_NATURE_ID); >- Set<IService> cServices = modelManager.getServices(CProjectNature.C_NATURE_ID); >- >- allApplicableServices.addAll(cppServices); >- allApplicableServices.addAll(cServices); >- } >- return allApplicableServices; >- } >- >- public Map<String, String> getServiceIDToSelectedProviderID() { >- return fServiceIDToSelectedProviderID; >- } >- >- public Table getTable() { >- return fTable; >- } >- >- public void setTable(Table table) { >- fTable = table; >- } >- >- public void setServiceIDToSelectedProviderID( >- Map<String, String> serviceIDToSelectedProviderID) { >- fServiceIDToSelectedProviderID = serviceIDToSelectedProviderID; >- } >- >- public Map<String, IServiceProvider> getProviderIDToProviderMap() { >- return fProviderIDToProviderMap; >- } >- >- public void setProviderIDToProviderMap( >- Map<String, IServiceProvider> providerIDToProviderMap) { >- fProviderIDToProviderMap = providerIDToProviderMap; >- } >- >- /** >- * Sub-class may override behaviour >- * @return true if all available services have been configured >- */ >- public boolean isConfigured() { >- return isConfigured(null, fServiceIDToSelectedProviderID, fProviderIDToProviderMap); >- } >- >- /** >- * Determine if all service providers have been configured >- * @param project >- * @param serviceIDToSelectedProviderID >- * @param providerIDToProviderMap >- * @return true if all service providers have been configured >- */ >- protected boolean isConfigured(IProject project, Map<String, String> serviceIDToSelectedProviderID, Map<String, IServiceProvider> providerIDToProviderMap) { >- Set<IService> allApplicableServices = getContributedServices(project); >- Iterator<IService> iterator = allApplicableServices.iterator(); >- boolean configured = true; >- while (iterator.hasNext()) { >- String providerID = serviceIDToSelectedProviderID.get(iterator.next().getId()); >- if (providerID == null) >- return false; >- else { >- IServiceProvider provider = providerIDToProviderMap.get(providerID); >- if (provider == null) >- return false; >- else >- configured = configured && provider.isConfigured(); >- } >- } >- return configured; >- } >- >- >- /** >- * @return the configuration change listener >- */ >- public Listener getConfigChangeListener() { >- return fConfigChangeListener; >- } >- >- /** >- * Listens for changes in service provider configuration >- * @param configChangeListener the configuration change listener to set >- */ >- public void setConfigChangeListener(Listener configChangeListener) { >- fConfigChangeListener = configChangeListener; >- } >- >- /** >- * Enable/disable the configure button in this widget based on the service provider descriptor selected >- * @param enabled >- */ >- protected void updateConfigureButton(IServiceProviderDescriptor descriptor) { >- //no need to configure the null providers so disable the configure button >- >- if (descriptor.getId().compareTo(NullBuildServiceProvider.ID) == 0 || >- descriptor.getId().compareTo(NullCIndexServiceProvider.ID) == 0) >- >- fConfigureButton.setEnabled(false); >- else >- fConfigureButton.setEnabled(true); >- } >-} >Index: src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWizardPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWizardPage.java,v >retrieving revision 1.10 >diff -u -r1.10 ServiceModelWizardPage.java >--- src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWizardPage.java 29 Oct 2009 21:00:22 -0000 1.10 >+++ src/org/eclipse/ptp/rdt/ui/wizards/ServiceModelWizardPage.java 2 Nov 2009 14:33:52 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ptp.rdt.ui.wizards; > >+import java.util.HashSet; > import java.util.LinkedHashSet; > import java.util.Set; > >@@ -17,20 +18,34 @@ > import org.eclipse.cdt.core.CProjectNature; > import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage; > import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager; >-import org.eclipse.cdt.ui.wizards.CDTMainWizardPage; > import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.jface.viewers.ISelectionChangedListener; >+import org.eclipse.jface.viewers.SelectionChangedEvent; > import org.eclipse.jface.wizard.IWizardPage; >-import org.eclipse.ptp.internal.rdt.ui.RDTHelpContextIds; >+import org.eclipse.ptp.internal.rdt.ui.RSEUtils; >+import org.eclipse.ptp.rdt.core.services.IRDTServiceConstants; > import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.rdt.ui.serviceproviders.RemoteBuildServiceProvider; >+import org.eclipse.ptp.rdt.ui.serviceproviders.RemoteCIndexServiceProvider; >+import org.eclipse.ptp.rdt.ui.serviceproviders.RemoteCIndexServiceProvider2; >+import org.eclipse.ptp.rdt.ui.subsystems.DStoreServerDefaults; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; > import org.eclipse.ptp.services.core.IService; > import org.eclipse.ptp.services.core.IServiceConfiguration; >+import org.eclipse.ptp.services.core.IServiceModelManager; >+import org.eclipse.ptp.services.core.IServiceProviderDescriptor; > import org.eclipse.ptp.services.core.ServiceModelManager; >-import org.eclipse.ptp.services.ui.widgets.ServiceProviderConfigurationWidget; >+import org.eclipse.ptp.services.ui.widgets.AddServiceConfigurationWidget; >+import org.eclipse.rse.connectorservice.dstore.DStoreConnectorService; >+import org.eclipse.rse.core.model.IHost; >+import org.eclipse.rse.core.subsystems.IConnectorService; > import org.eclipse.swt.SWT; > import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >-import org.eclipse.ui.PlatformUI; > > /** > * >@@ -39,25 +54,23 @@ > * 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 DEFAULT_CONFIG = Messages.getString("ConfigureRemoteServices.0"); //$NON-NLS-1$ >- >- public static final String SERVICE_MODEL_WIDGET_PROPERTY = "org.eclipse.ptp.rdt.ui.ServiceModelWizardPage.serviceModelWidget"; //$NON-NLS-1$ >+ public static final String CONFIG_PROPERTY = "org.eclipse.ptp.rdt.ui.ServiceModelWizardPage.serviceConfig"; //$NON-NLS-1$ > > boolean fbVisited; > private String fTitle; > private String fDescription; > private ImageDescriptor fImageDescriptor; > private Image fImage; >- private Control fCanvas; >- private IServiceConfiguration fConfig; >- private ServiceProviderConfigurationWidget fModelWidget; >+ private IServiceConfiguration fNewConfig; >+ private Control pageControl; >+ >+ private AddServiceConfigurationWidget serviceConfigWidget; > >- > public ServiceModelWizardPage(String pageID) { > super(pageID); > } >@@ -80,6 +93,7 @@ > return allApplicableServices; > } > >+ > /** > * > */ >@@ -104,40 +118,125 @@ > /* (non-Javadoc) > * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) > */ >- public void createControl(Composite parent) { >- fCanvas = parent; // TODO >- fModelWidget = new ServiceProviderConfigurationWidget(parent, SWT.NONE); >- >- MBSCustomPageManager.addPageProperty(pageID, SERVICE_MODEL_WIDGET_PROPERTY, fModelWidget); >+ public void createControl(final Composite parent) { >+ Composite comp = new Composite(parent, SWT.NONE); >+ comp.setLayout(new GridLayout(1, false)); >+ comp.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ pageControl = comp; >+ >+ serviceConfigWidget = new AddServiceConfigurationWidget(comp, SWT.NONE); >+ GridData data = new GridData(GridData.FILL_BOTH); >+ serviceConfigWidget.setLayoutData(data); >+ serviceConfigWidget.addSelectionChangedListener(new ISelectionChangedListener() { >+ public void selectionChanged(SelectionChangedEvent event) { >+ updateConfigPageProperty(); >+ } >+ }); >+ serviceConfigWidget.setDefaultConfiguration(getNewConfiguration()); >+ serviceConfigWidget.setSelection(true); >+ >+ updateConfigPageProperty(); >+ } >+ >+ private void updateConfigPageProperty() { >+ IServiceConfiguration config = serviceConfigWidget.getServiceConfiguration(); >+ MBSCustomPageManager.addPageProperty( >+ SERVICE_MODEL_WIZARD_PAGE_ID, CONFIG_PROPERTY, config); > >- String configName = DEFAULT_CONFIG; >+ } >+ >+ private String getDefaultConfigName() { >+ String candidateName = DEFAULT_CONFIG; > IWizardPage page = getWizard().getStartingPage(); >- if(page instanceof CDTMainWizardPage) { >- CDTMainWizardPage cdtPage = (CDTMainWizardPage) page; >- configName = cdtPage.getProjectName(); >+ if(page instanceof NewRemoteProjectCreationPage) { >+ NewRemoteProjectCreationPage cdtPage = (NewRemoteProjectCreationPage) page; >+ candidateName = cdtPage.getRemoteConnection().getName(); > } > >- fConfig = ServiceModelManager.getInstance().newServiceConfiguration(configName); >+ Set<IServiceConfiguration> configs = ServiceModelManager.getInstance().getConfigurations(); >+ Set<String> existingNames = new HashSet<String>(); >+ for(IServiceConfiguration config : configs) { >+ existingNames.add(config.getName()); >+ } > >- fModelWidget.setServiceConfiguration(fConfig); >+ int i = 2; >+ String newConfigName = candidateName; >+ while(existingNames.contains(newConfigName)) { >+ newConfigName = candidateName + " (" + (i++) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } > >- Control control = fModelWidget.getParent().getShell(); //get the shell or doesn't display help correctly >- PlatformUI.getWorkbench().getHelpSystem().setHelp(control,RDTHelpContextIds.SERVICE_MODEL_WIZARD); >+ return newConfigName; > } >- >+ >+ /** >+ * Creates a new configuration with the RDT defaults. >+ */ >+ private IServiceConfiguration getNewConfiguration() { >+ if(fNewConfig == null) { >+ IServiceModelManager smm = ServiceModelManager.getInstance(); >+ fNewConfig = smm.newServiceConfiguration(getDefaultConfigName()); >+ >+ IWizardPage page = getWizard().getStartingPage(); >+ if(page instanceof NewRemoteProjectCreationPage) { >+ NewRemoteProjectCreationPage cdtPage = (NewRemoteProjectCreationPage) page; >+ IRemoteServices remoteServices = cdtPage.getRemoteServices(); >+ IRemoteConnection remoteConnection = cdtPage.getRemoteConnection(); >+ >+ IService buildService = smm.getService(IRDTServiceConstants.SERVICE_BUILD); >+ IServiceProviderDescriptor descriptor = buildService.getProviderDescriptor(RemoteBuildServiceProvider.ID); >+ RemoteBuildServiceProvider rbsp = (RemoteBuildServiceProvider)smm.getServiceProvider(descriptor); >+ rbsp.setRemoteToolsProviderID(remoteServices.getId()); >+ rbsp.setRemoteToolsConnection(remoteConnection); >+ fNewConfig.setServiceProvider(buildService, rbsp); >+ >+ if (remoteServices.getId().equals("org.eclipse.ptp.remote.RSERemoteServices")) { //$NON-NLS-1$ >+ IService indexingService = smm.getService(IRDTServiceConstants.SERVICE_C_INDEX); >+ descriptor = indexingService.getProviderDescriptor(RemoteCIndexServiceProvider.ID); >+ RemoteCIndexServiceProvider rcisp = (RemoteCIndexServiceProvider) smm.getServiceProvider(descriptor); >+ >+ String hostName = remoteConnection.getAddress(); >+ IHost host = RSEUtils.getConnection(hostName); >+ String configPath = RSEUtils.getDefaultConfigDirectory(host); >+ >+ rcisp.setConnection(host, getDStoreConnectorService(host)); >+ rcisp.setIndexLocation(configPath); >+ rcisp.setConfigured(true); >+ fNewConfig.setServiceProvider(indexingService, rcisp); >+ } else if (remoteServices.getId().equals("org.eclipse.ptp.remote.RemoteTools")) { //$NON-NLS-1$ >+ IService indexingService = smm.getService(IRDTServiceConstants.SERVICE_C_INDEX); >+ descriptor = indexingService.getProviderDescriptor(RemoteCIndexServiceProvider2.ID); >+ RemoteCIndexServiceProvider2 rcisp = (RemoteCIndexServiceProvider2) smm.getServiceProvider(descriptor); >+ rcisp.setConnection(remoteServices, remoteConnection); >+ rcisp.setDStoreCommand(DStoreServerDefaults.COMMAND); >+ rcisp.setDStoreEnv("CLASSPATH=" + DStoreServerDefaults.CLASSPATH); //$NON-NLS-1$ >+ fNewConfig.setServiceProvider(indexingService, rcisp); >+ } >+ } >+ } >+ >+ return fNewConfig; >+ } >+ >+ private IConnectorService getDStoreConnectorService(IHost host) { >+ for(IConnectorService cs : host.getConnectorServices()) { >+ if(cs instanceof DStoreConnectorService) >+ return cs; >+ } >+ return null; >+ } >+ > /* (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 fModelWidget; >+ return pageControl; > } > > /* (non-Javadoc) >@@ -226,7 +325,6 @@ > if(visible) { > fbVisited = true; > } >- fCanvas.setVisible(visible); > } > > >Index: src/org/eclipse/ptp/rdt/ui/wizards/RemoteCIndexServiceProviderConfigurer.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/RemoteCIndexServiceProviderConfigurer.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/RemoteCIndexServiceProviderConfigurer.java >--- src/org/eclipse/ptp/rdt/ui/wizards/RemoteCIndexServiceProviderConfigurer.java 17 Sep 2009 15:51:49 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,36 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008, 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 - Initial API and implementation >- *******************************************************************************/ >-package org.eclipse.ptp.rdt.ui.wizards; >- >-import org.eclipse.jface.dialogs.Dialog; >-import org.eclipse.ptp.services.core.IServiceProvider; >-import org.eclipse.ptp.services.ui.IServiceProviderConfiguration; >-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 >- * @deprecated >- */ >-public class RemoteCIndexServiceProviderConfigurer implements IServiceProviderConfiguration { >- >- public void configureServiceProvider(IServiceProvider provider, Shell parentShell) { >- Dialog configDialog = new HostSelectionDialog(provider, parentShell); >- configDialog.open(); >- } >- >-} >Index: src/org/eclipse/ptp/rdt/ui/wizards/ConvertToRemoteServiceModelWidget.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/ConvertToRemoteServiceModelWidget.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/ConvertToRemoteServiceModelWidget.java >--- src/org/eclipse/ptp/rdt/ui/wizards/ConvertToRemoteServiceModelWidget.java 1 Sep 2009 15:52:38 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,205 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008, 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 >- *******************************************************************************/ >- >-package org.eclipse.ptp.rdt.ui.wizards; >- >-import java.util.HashMap; >-import java.util.Iterator; >-import java.util.Map; >-import java.util.Set; >- >-import org.eclipse.core.resources.IProject; >-import org.eclipse.ptp.rdt.ui.messages.Messages; >-import org.eclipse.ptp.rdt.ui.serviceproviders.NullBuildServiceProvider; >-import org.eclipse.ptp.rdt.ui.serviceproviders.NullCIndexServiceProvider; >-import org.eclipse.ptp.services.core.IService; >-import org.eclipse.ptp.services.core.IServiceProvider; >-import org.eclipse.ptp.services.core.IServiceProviderDescriptor; >-import org.eclipse.ptp.services.core.ServiceModelManager; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.widgets.Event; >-import org.eclipse.swt.widgets.Listener; >-import org.eclipse.swt.widgets.TableItem; >- >-/** >- * A table widget listing remote services and service providers. This widget is used in >- * ConvertToRemoteWizardPage and it stores information on the remote service model for the >- * projects to be converted. >- * >- * <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 ConvertToRemoteServiceModelWidget extends ServiceModelWidget { >- >- IProject fCurrentProject; >- >- Map<IProject, Map<String,String>> projectToServices = new HashMap<IProject, Map<String,String>>(); >- Map<IProject, Map<String,IServiceProvider>> projectToProviders = new HashMap<IProject, Map<String,IServiceProvider>>(); >- >- public class ConfigureListener2 extends ConfigureListener { >- public void handleEvent(Event event) { >- super.handleEvent(event); >- //users have to configure the services manually by clicking the configure button, not done automatically >- //once the services have been configured, they will be saved >- projectToServices.put(fCurrentProject, fServiceIDToSelectedProviderID); >- projectToProviders.put(fCurrentProject, fProviderIDToProviderMap); >- } >- } >- >- /** >- * Find available remote services and service providers for the given project and >- * add them to the table >- * @param project >- */ >- public void addServicesToTable(IProject project) { >- fProviderIDToProviderMap = new HashMap<String, IServiceProvider>(); >- fServiceIDToSelectedProviderID = new HashMap<String, String>(); >- fCurrentProject = project; >- createTableContent(project); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ptp.rdt.ui.wizards.ServiceModelWidget#createTableContent(org.eclipse.core.resources.IProject) >- */ >- @Override >- protected void createTableContent(IProject project) { >- fTable.removeAll(); >- if (project == null) { >- super.createTableContent(project); >- } else if (projectToServices.get(project) == null && projectToProviders.get(project) == null) { >- super.createTableContent(project); >- } else { >- Set<IService> services = getContributedServices(project); >- Iterator<IService> iterator = services.iterator(); >- >- Map<String, String> serviceIDToSelectedProviderID = projectToServices.get(fCurrentProject); >- Map<String, IServiceProvider> providerIDToProviderMap = projectToProviders.get(fCurrentProject); >- >- while(iterator.hasNext()) { >- final IService service = iterator.next(); >- >- TableItem item = new TableItem (fTable, SWT.NONE); >- >- // column 0 lists the name of the service >- item.setText (0, service.getName()); >- item.setData(SERVICE_KEY, service); >- >- String providerID = serviceIDToSelectedProviderID.get(service.getId()); >- IServiceProvider provider= providerIDToProviderMap.get(providerID); >- String configString; >- >- //remember user's selection and restore >- if (provider != null) { >- // column 1 holds a dropdown with a list of providers >- item.setText(1, provider.getName()); >- item.setData(PROVIDER_KEY, provider); >- >- configString = provider.getConfigurationString(); >- } else { //no previous user selection >- >- // column 1 holds a dropdown with a list of providers >- // default entry is the null provider if there is one >- IServiceProviderDescriptor descriptor; >- if (service.getId().compareTo(NullBuildServiceProvider.SERVICE_ID) == 0) >- descriptor = service.getProviderDescriptor(NullBuildServiceProvider.ID); >- else if (service.getId().compareTo(NullCIndexServiceProvider.SERVICE_ID) == 0) >- descriptor = service.getProviderDescriptor(NullCIndexServiceProvider.ID); >- else >- descriptor = service.getProviders().iterator().next(); >- item.setText(1, descriptor.getName()); >- item.setData(PROVIDER_KEY, descriptor); >- >- //No actual providers are created yet so there's no configuration >- configString = Messages.getString("ServiceModelWidget.4"); //$NON-NLS-1$ >- >- if (descriptor.getId().compareTo(NullBuildServiceProvider.ID) == 0 || >- descriptor.getId().compareTo(NullCIndexServiceProvider.ID) == 0) { >- >- //since the null providers are choosen, setup the service provider mappings >- ServiceModelManager manager = ServiceModelManager.getInstance(); >- IServiceProvider serviceProvider = manager.getServiceProvider(descriptor); >- >- configString = serviceProvider.getConfigurationString(); >- // column 2 holds the configuration string of the provider's current configuration >- if (configString == null) { >- configString = Messages.getString("ServiceModelWidget.4"); //$NON-NLS-1$ >- } >- fServiceIDToSelectedProviderID.put(service.getId(), descriptor.getId()); >- fProviderIDToProviderMap.put(descriptor.getId(), serviceProvider); >- } >- } >- >- // column 2 holds the configuration string of the provider's current configuration >- if (configString == null) { >- configString = Messages.getString("ServiceModelWidget.4"); //$NON-NLS-1$ >- } >- item.setText(2, configString); >- } >- >- fServiceIDToSelectedProviderID.putAll(serviceIDToSelectedProviderID); >- fProviderIDToProviderMap.putAll(providerIDToProviderMap); >- } >- projectToServices.put(project, fServiceIDToSelectedProviderID); >- projectToProviders.put(project, fProviderIDToProviderMap); >- >- if (fConfigChangeListener != null) >- fConfigChangeListener.handleEvent(null); >- >- //reset the configuration button >- if (fConfigureButton != null) >- fConfigureButton.setEnabled(false); >- } >- >- public void emptyTable() { >- fTable.removeAll(); >- } >- >- protected Listener getConfigureListener() { >- return new ConfigureListener2(); >- } >- >- /** >- * @return the projectToServices >- */ >- public Map<IProject, Map<String, String>> getProjectToServices() { >- return projectToServices; >- } >- >- /** >- * @return the projectToProviders >- */ >- public Map<IProject, Map<String, IServiceProvider>> getProjectToProviders() { >- return projectToProviders; >- } >- >- public boolean isConfigured(Object[] selectedProjects) { >- boolean configured = true; >- if (selectedProjects == null || selectedProjects.length < 1) >- return false; >- for (int i = 0; i < selectedProjects.length; i++) { >- IProject project = (IProject) selectedProjects[i]; >- Map<String, String> serviceIDToSelectedProviderID = projectToServices.get(project); >- Map<String, IServiceProvider> providerIDToProviderMap = projectToProviders.get(project); >- if (serviceIDToSelectedProviderID == null || providerIDToProviderMap == null) >- return false; >- configured = configured && isConfigured(project, serviceIDToSelectedProviderID, providerIDToProviderMap); >- } >- >- return configured; >- >- } >- >-} >Index: src/org/eclipse/ptp/rdt/ui/wizards/ConfigureRemoteServices.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/ConfigureRemoteServices.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/ConfigureRemoteServices.java >--- src/org/eclipse/ptp/rdt/ui/wizards/ConfigureRemoteServices.java 1 Sep 2009 15:52:39 -0000 1.8 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,85 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008, 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 - Initial API and implementation >- *******************************************************************************/ >-package org.eclipse.ptp.rdt.ui.wizards; >- >-import java.io.IOException; >-import java.util.Map; >- >-import org.eclipse.cdt.core.CCorePlugin; >-import org.eclipse.cdt.core.model.ICProject; >-import org.eclipse.cdt.internal.core.model.CModelManager; >-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.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.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, Map<String, String> serviceIDToProviderIDMap, >- Map<String, IServiceProvider> providerIDToProviderMap, IProgressMonitor monitor) { >- >- monitor.beginTask("actual Configure remote services", 100); //$NON-NLS-1$ >- >- if(project == null) >- throw new NullPointerException(); >- >- final ServiceModelManager serviceModelManager = ServiceModelManager.getInstance(); >- >- IServiceConfiguration config = serviceModelManager.newServiceConfiguration(DEFAULT_CONFIG); >- >- int workUnit = 90/serviceIDToProviderIDMap.size(); >- >- for(String serviceID : serviceIDToProviderIDMap.keySet()) { >- IService service = serviceModelManager.getService(serviceID); >- String serviceProviderID = serviceIDToProviderIDMap.get(serviceID); >- IServiceProvider provider = providerIDToProviderMap.get(serviceProviderID); >- config.setServiceProvider(service, provider); >- >- monitor.worked(workUnit); >- >- //have to set it as active >- serviceModelManager.addConfiguration(project, config); >- serviceModelManager.setActiveConfiguration(project, config); >- } >- >- try { >- serviceModelManager.saveModelConfiguration(); >- } catch (IOException e) { >- Activator.logError(e.toString(), e); >- } >- >- ICProject cProject = CModelManager.getDefault().getCModel().getCProject(project); >- CCorePlugin.getIndexManager().setIndexerId(cProject, RemoteFastIndexer.ID); >- monitor.worked(10); >- monitor.done(); >- } >-} >Index: src/org/eclipse/ptp/rdt/ui/UIPlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/UIPlugin.java,v >retrieving revision 1.6 >diff -u -r1.6 UIPlugin.java >--- src/org/eclipse/ptp/rdt/ui/UIPlugin.java 17 Sep 2009 15:51:50 -0000 1.6 >+++ src/org/eclipse/ptp/rdt/ui/UIPlugin.java 2 Nov 2009 14:33:51 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.core.runtime.Preferences; > import org.eclipse.core.runtime.Status; > import org.eclipse.ptp.rdt.ui.serviceproviders.IndexLocationChangeListener; >+import org.eclipse.ptp.rdt.ui.subsystems.DStoreServerDefaults; > import org.eclipse.swt.widgets.Display; > import org.eclipse.ui.internal.editors.text.EditorsPlugin; > import org.osgi.framework.BundleContext; >@@ -64,6 +65,7 @@ > > IndexLocationChangeListener.startListening(); > turnOffIndexerAnnotations(); >+ DStoreServerDefaults.loadDefaults(); > } > > >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/plugin.properties,v >retrieving revision 1.21 >diff -u -r1.21 plugin.properties >--- plugin.properties 14 Oct 2009 14:53:32 -0000 1.21 >+++ plugin.properties 2 Nov 2009 14:33:51 -0000 >@@ -33,6 +33,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: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/plugin.xml,v >retrieving revision 1.33 >diff -u -r1.33 plugin.xml >--- plugin.xml 15 Oct 2009 18:13:36 -0000 1.33 >+++ plugin.xml 2 Nov 2009 14:33:51 -0000 >@@ -116,37 +116,19 @@ > <wizard > canFinishEarly="false" > category="org.eclipse.ptp.rdt.ui.wizardCategory.Remote" >- class="org.eclipse.ptp.rdt.ui.wizards.NewRemoteCppProjectWizard" >+ class="org.eclipse.ptp.rdt.ui.wizards.NewRemoteProjectWizard" > finalPerspective="org.eclipse.ptp.rdt.ui.remoteCPerspective" > hasPages="true" > icon="icons/etool16/newremote_c_proj.gif" > id="org.eclipse.ptp.rdt.ui.newRemoteProjectWizard" > name="%wizard.name.0" > project="true"> >- <description> >- %remoteCCPPproject.desc >- </description> > </wizard> > > <wizard >- canFinishEarly="false" >- category="org.eclipse.cdt.ui.newCWizards" >- class="org.eclipse.ptp.rdt.ui.wizards.NewRemoteCppProjectWizard" >- finalPerspective="org.eclipse.ptp.rdt.ui.remoteCPerspective" >- hasPages="true" >- icon="icons/etool16/newremote_c_proj.gif" >- id="org.eclipse.ptp.rdt.ui.newCRemoteProjectWizard" >- name="%wizard.name.0" >- project="true"> >- <description> >- %remoteCCPPproject.desc >- </description> >- </wizard> >- >- <wizard > category="org.eclipse.ptp.rdt.ui.wizardCategory.Remote" > class="org.eclipse.ptp.rdt.ui.wizards.ConvertToRemoteWizard" >- finalPerspective="org.eclipse.ptp.rdt.ui.remoteCPerspective" >+ finalPerspective="org.eclipse.cdt.ui.CPerspective" > hasPages="true" > icon="icons/obj16/convert-normal.gif" > id="org.eclipse.ptp.rdt.ui.wizards.ConvertToMakeWizard" >@@ -158,7 +140,7 @@ > <selection > class="org.eclipse.core.resources.IProject"> > </selection> >- </wizard> >+ </wizard> > </extension> > <extension > point="org.eclipse.cdt.ui.IndexerPage"> >@@ -188,6 +170,13 @@ > priority="1" > serviceId="org.eclipse.ptp.rdt.core.BuildService"> > </provider> >+ <provider >+ class="org.eclipse.ptp.rdt.ui.serviceproviders.RemoteCIndexServiceProvider2" >+ id="org.eclipse.ptp.rdt.ui.RemoteCIndexServiceProvider2" >+ name="Remote Tools C/C++ Indexing Service" >+ priority="1" >+ serviceId="org.eclipse.ptp.rdt.core.CIndexingService"> >+ </provider> > </extension> > <extension > id="org.eclipse.ptp.rdt.core.remoteNature" >@@ -628,6 +617,10 @@ > configurationUIClass="org.eclipse.ptp.rdt.ui.wizards.RemoteServicesServiceProviderConfigurer" > id="org.eclipse.ptp.rdt.ui.RemoteBuildServiceProvider"> > </providerContributor> >+ <providerContributor >+ class="org.eclipse.ptp.rdt.ui.wizards.RemoteCIndexServiceProvider2Contributer" >+ id="org.eclipse.ptp.rdt.ui.RemoteCIndexServiceProvider2"> >+ </providerContributor> > </extension> > <extension > point="org.eclipse.ptp.services.core.serviceCategories"> >Index: src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerRunner.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerRunner.java >diff -N src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerRunner.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerRunner.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,287 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.subsystems; >+ >+import java.io.BufferedReader; >+import java.io.IOException; >+import java.io.InputStreamReader; >+import java.util.Arrays; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.core.filesystem.IFileStore; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.dstore.core.client.ClientConnection; >+import org.eclipse.dstore.core.client.ConnectionStatus; >+import org.eclipse.dstore.core.model.DataStore; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.ptp.rdt.ui.UIPlugin; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteFileManager; >+import org.eclipse.ptp.remote.core.IRemoteProcess; >+import org.eclipse.ptp.remote.core.IRemoteProcessBuilder; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+import org.eclipse.ptp.remote.core.exception.RemoteConnectionException; >+ >+public class DStoreServerRunner extends Job { >+ public enum DStoreServerState {STARTING, RUNNING, FINISHED, ERROR} >+ >+ private boolean DEBUG = true; >+ >+ private List<String> fCommand; >+ >+ private String workDir = null; >+ private Map<String, String> fEnv = new HashMap<String, String>(); >+ private DStoreServerState fServerState = DStoreServerState.STARTING; >+ private IRemoteServices fRemoteServices; >+ >+ private IRemoteConnection fRemoteConnection; >+ private IRemoteProcess fRemoteProcess; >+ private ClientConnection fDStoreConnection = null; >+ private int fPort; >+ private static final String fSuccessString = "Server Started Successfully"; //$NON-NLS-1$ >+ >+ public DStoreServerRunner(IRemoteServices services, IRemoteConnection connection) { >+ super("DStoreServerRunner"); //$NON-NLS-1$ >+ setPriority(Job.LONG); >+ setSystem(!DEBUG); >+ fRemoteServices = services; >+ fRemoteConnection = connection; >+ } >+ >+ public DataStore getDataStore() { >+ if (fDStoreConnection == null) { >+ fDStoreConnection = new ClientConnection(fRemoteConnection.getName()); >+ } >+ return fDStoreConnection.getDataStore(); >+ } >+ >+ public synchronized DStoreServerState getServerState() { >+ return fServerState; >+ } >+ >+ public void setCommand(String command) { >+ if (command != null) { >+ fCommand = Arrays.asList(command.split(" ")); //$NON-NLS-1$ >+ } >+ } >+ >+ public void setEnv(String env) { >+ if (env != null) { >+ for (String vars : env.split("\n")) { //$NON-NLS-1$ >+ String[] envVar = vars.split("="); //$NON-NLS-1$ >+ if (envVar.length == 2) { >+ fEnv.put(envVar[0], envVar[1]); >+ } >+ } >+ } >+ } >+ >+ public void setWorkDir(String workDir) { >+ this.workDir = workDir; >+ } >+ >+ public synchronized boolean startServer() { >+ if (fServerState == DStoreServerState.RUNNING) { >+ return false; >+ } >+ if (fServerState == DStoreServerState.FINISHED || >+ fServerState == DStoreServerState.ERROR) { >+ setServerState(DStoreServerState.STARTING); >+ fPort = 0; >+ } >+ if (!fRemoteConnection.isOpen()) { >+ try { >+ fRemoteConnection.open(null); >+ } catch (RemoteConnectionException e) { >+ e.printStackTrace(); >+ return false; >+ } >+ } >+ schedule(); >+ while (getServerState() == DStoreServerState.STARTING) { >+ try { >+ wait(500); >+ } catch (InterruptedException e) { >+ if (DStoreServerDefaults.DSTORE_TRACING) { >+ System.err.println("DSTORE SERVER: InterruptedException " + e.getLocalizedMessage()); //$NON-NLS-1$ >+ } >+ return false; >+ } >+ } >+ if (fServerState == DStoreServerState.RUNNING) { >+ int port; >+ try { >+ port = fRemoteConnection.forwardLocalPort("localhost", fPort, null); //$NON-NLS-1$ >+ } catch (RemoteConnectionException e) { >+ if (DStoreServerDefaults.DSTORE_TRACING) { >+ System.err.println("DSTORE SERVER: port fowarding failed " + e.getLocalizedMessage()); //$NON-NLS-1$ >+ } >+ return false; >+ } >+ fDStoreConnection.setHost("localhost"); //$NON-NLS-1$ >+ fDStoreConnection.setPort(Integer.toString(port)); >+ ConnectionStatus status = fDStoreConnection.connect(null, 0); >+ DataStore dataStore = fDStoreConnection.getDataStore(); >+ dataStore.showTicket(null); >+ dataStore.registerLocalClassLoader(getClass().getClassLoader()); >+ return status.isConnected(); >+ } >+ return false; >+ } >+ >+ @Override >+ protected void canceling() { >+ terminateServer(); >+ } >+ >+ @Override >+ protected IStatus run(IProgressMonitor monitor) { >+ assert fCommand != null; >+ assert fRemoteProcess == null; >+ >+ /* >+ * Catch all try...catch >+ */ >+ try { >+ if (monitor.isCanceled()) { >+ return Status.CANCEL_STATUS; >+ } >+ /* >+ * Prepare remote connection. >+ */ >+ IRemoteFileManager fileManager = fRemoteServices.getFileManager(fRemoteConnection); >+ >+ IFileStore directory = null; >+ if (workDir != null) { >+ directory = fileManager.getResource(workDir); >+ } >+ IRemoteProcessBuilder builder = fRemoteServices.getProcessBuilder(fRemoteConnection, fCommand); >+ if (directory != null) { >+ builder.directory(directory); >+ } >+ >+ builder.environment().putAll(fEnv); >+ >+ /* >+ * Create process. >+ */ >+ if (monitor.isCanceled()) { >+ return Status.CANCEL_STATUS; >+ } >+ >+ synchronized (this) { >+ fRemoteProcess = builder.start(); >+ } >+ >+ if (DStoreServerDefaults.DSTORE_TRACING) { >+ final BufferedReader stdout = new BufferedReader(new InputStreamReader(fRemoteProcess.getInputStream())); >+ new Thread(new Runnable() { >+ public void run() { >+ try { >+ String output; >+ while ((output = stdout.readLine()) != null) { >+ System.out.println("DSTORE SERVER stdout: " + output); //$NON-NLS-1$ >+ } >+ } catch (IOException e) { >+ // Ignore >+ } >+ } >+ }, "dstore server stdout").start(); //$NON-NLS-1$ >+ } >+ >+ final BufferedReader stderr = new BufferedReader(new InputStreamReader(fRemoteProcess.getErrorStream())); >+ new Thread(new Runnable() { >+ public void run() { >+ try { >+ String output; >+ while ((output = stderr.readLine()) != null) { >+ if (getServerState() == DStoreServerState.STARTING && output.startsWith(fSuccessString)) { >+ if ((output = stderr.readLine()) != null && output.matches("^[0-9]+$")) { //$NON-NLS-1$ >+ fPort = Integer.parseInt(output); >+ setServerState(DStoreServerState.RUNNING); >+ if (DStoreServerDefaults.DSTORE_TRACING) { >+ System.err.println("DSTORE SERVER started on port " + output); //$NON-NLS-1$ >+ } >+ } >+ } >+ if (DStoreServerDefaults.DSTORE_TRACING) { >+ System.err.println("DSTORE SERVER stderr: " + output); //$NON-NLS-1$ >+ } >+ } >+ } catch (IOException e) { >+ // Ignore >+ } >+ } >+ }, "dstore server stderr").start(); //$NON-NLS-1$ >+ >+ /* >+ * Wait while running but not canceled. >+ */ >+ while (!fRemoteProcess.isCompleted() && !monitor.isCanceled()) { >+ synchronized (this) { >+ try { >+ wait(500); >+ } catch (InterruptedException e) { >+ // Ignore interrupt; >+ } >+ } >+ } >+ >+ try { >+ fRemoteProcess.waitFor(); >+ } catch (InterruptedException e) { >+ // Do nothing >+ } >+ >+ /* >+ * Check if process terminated successfully (if not canceled). >+ */ >+ if (fRemoteProcess.exitValue() != 0) { >+ if (!monitor.isCanceled()) { >+ throw new CoreException(new Status(IStatus.ERROR, UIPlugin.getPluginId(), NLS.bind("DStore server finished with exit code {0}", fRemoteProcess.exitValue()))); //$NON-NLS-1$ >+ } >+ } >+ setServerState(DStoreServerState.FINISHED); >+ return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS; >+ } catch (CoreException e) { >+ setServerState(DStoreServerState.ERROR); >+ return e.getStatus(); >+ } catch (IOException e) { >+ setServerState(DStoreServerState.ERROR); >+ return new Status(IStatus.ERROR, UIPlugin.getPluginId(), "failed to start dstore server", e); //$NON-NLS-1$ >+ } finally { >+ synchronized (this) { >+ fRemoteProcess = null; >+ if (fDStoreConnection != null) { >+ fDStoreConnection.disconnect(); >+ fDStoreConnection = null; >+ } >+ } >+ } >+ } >+ >+ protected synchronized void setServerState(DStoreServerState state) { >+ if (DStoreServerDefaults.DSTORE_TRACING) { >+ System.err.println("DSTORE SERVER new state: " + state.toString()); //$NON-NLS-1$ >+ } >+ fServerState = state; >+ this.notifyAll(); >+ } >+ >+ protected synchronized void terminateServer() { >+ if (fServerState == DStoreServerState.RUNNING && fRemoteProcess != null) { >+ fRemoteProcess.destroy(); >+ } >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteProjectCreationPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteProjectCreationPage.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteProjectCreationPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteProjectCreationPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,365 @@ >+/******************************************************************************* >+ * 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.wizards; >+ >+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.wizards.RemoteProjectContentsLocationArea.IErrorMessageReporter; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+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(); >+ } >+ >+ >+ public IRemoteConnection getRemoteConnection() { >+ return locationArea.getRemoteConnection(); >+ } >+ >+ >+ public IRemoteServices getRemoteServices() { >+ return locationArea.getRemoteServices(); >+ } >+ >+ /** >+ * 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/wizards/DStoreIndexPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/DStoreIndexPage.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/DStoreIndexPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/DStoreIndexPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,74 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.wizards; >+ >+import org.eclipse.core.runtime.ListenerList; >+import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.rdt.ui.wizards.DStoreServerWidget.FieldModifier; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+import org.eclipse.ptp.remote.ui.widgets.RemoteDirectoryWidget; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+ >+public class DStoreIndexPage extends Composite { >+ private String fDefaultPath = null; >+ private RemoteDirectoryWidget fDirectoryWidget; >+ private ListenerList modifyListeners = new ListenerList(); >+ >+ public DStoreIndexPage(Composite parent, int style) { >+ super(parent, style); >+ >+ GridLayout layout = new GridLayout(2, false); >+ setLayout(layout); >+ setLayoutData(new GridData(GridData.FILL_BOTH)); >+ >+ fDirectoryWidget = new RemoteDirectoryWidget(this, SWT.NONE, Messages.getString("IndexFileLocationWidget.0"), fDefaultPath); //$NON-NLS-1$ >+ fDirectoryWidget.setBrowseMessage("Select Index File Location"); //$NON-NLS-1$ >+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); >+ data.horizontalSpan = 3; >+ fDirectoryWidget.setLayoutData(data); // set layout to grab horizontal space >+ fDirectoryWidget.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ fDefaultPath = fDirectoryWidget.getLocationPath(); >+ e.data = FieldModifier.VALUE_INDEX_LOCATION; >+ notifyListeners(e); >+ } >+ }); >+ } >+ >+ public void addModifyListener(ModifyListener listener) { >+ modifyListeners.add(listener); >+ } >+ >+ public String getLocationPath() { >+ return fDirectoryWidget.getLocationPath(); >+ } >+ >+ public void removeModifyListener(ModifyListener listener) { >+ modifyListeners.remove(listener); >+ } >+ >+ public void setConnection(IRemoteServices services, IRemoteConnection conn) { >+ fDirectoryWidget.setConnection(services, conn); >+ } >+ >+ public void setLocationPath(String path) { >+ fDirectoryWidget.setLocationPath(path); >+ } >+ >+ private void notifyListeners(ModifyEvent e) { >+ for (Object listener : modifyListeners.getListeners()) { >+ ((ModifyListener)listener).modifyText(e); >+ } >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerDefaults.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerDefaults.java >diff -N src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerDefaults.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerDefaults.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,107 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation. >+ * 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 >+ ******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.subsystems; >+ >+import java.io.IOException; >+import java.io.InputStream; >+import java.util.Properties; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.FileLocator; >+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.osgi.util.NLS; >+import org.eclipse.ptp.rdt.ui.UIPlugin; >+import org.osgi.framework.Bundle; >+ >+public class DStoreServerDefaults { >+ >+ public static String COMMAND = null; >+ public static String CLASSPATH = null; >+ public static boolean DSTORE_TRACING = false; >+ >+ private static final String DEFAULTS_RESOURCE_PATH = "/data/dstore-server.properties"; //$NON-NLS-1$ >+ private static final String DSTORE_TRACING_OPTION = "org.eclipse.ptp.rdt.ui/debug/dstore/tracing"; //$NON-NLS-1$ >+ >+ public static void loadDefaults() throws CoreException { >+ if (UIPlugin.getDefault().isDebugging()) { >+ String option = Platform.getDebugOption(DSTORE_TRACING_OPTION); >+ if (option != null) { >+ DSTORE_TRACING = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ >+ } >+ } >+ >+ Bundle bundle = UIPlugin.getDefault().getBundle(); >+ Properties properties = read(new Path(DEFAULTS_RESOURCE_PATH), bundle); >+ >+ COMMAND = getString(bundle, properties, "COMMAND"); //$NON-NLS-1$ >+ CLASSPATH = getString(bundle, properties, "CLASSPATH"); //$NON-NLS-1$ >+ >+ assert COMMAND != null; >+ assert CLASSPATH != null; >+ } >+ >+ public static Properties read(Path defaultsPropertiesPath, Bundle bundle) >+ throws CoreException { >+ InputStream inStream; >+ Properties properties = new Properties(); >+ try { >+ inStream = FileLocator.openStream(bundle, defaultsPropertiesPath, >+ false); >+ properties.load(inStream); >+ >+ } catch (IOException e) { >+ throw new CoreException(new Status(IStatus.ERROR, bundle >+ .getSymbolicName(), >+ "Failed to read DStore Server properties file")); //$NON-NLS-1$ >+ } >+ return properties; >+ } >+ >+ public static String getString(Bundle bundle, Properties properties, >+ String key) throws CoreException { >+ String value = properties.getProperty(key); >+ if (value == null) { >+ throw new CoreException( >+ new Status( >+ IStatus.ERROR, >+ bundle.getSymbolicName(), >+ NLS >+ .bind( >+ "Missing default value for {0} while reading DStore Server properties", key))); //$NON-NLS-1$ >+ } >+ return value; >+ } >+ >+ public static int getInteger(Bundle bundle, Properties properties, >+ String key) throws CoreException { >+ String value = getString(bundle, properties, key); >+ try { >+ return Integer.parseInt(value); >+ } catch (NumberFormatException e) { >+ throw new CoreException( >+ new Status( >+ IStatus.ERROR, >+ bundle.getSymbolicName(), >+ NLS >+ .bind( >+ "Invalid value for {0} while reading DStore Server properties", key))); //$NON-NLS-1$ >+ } >+ } >+ >+ public static boolean getBoolean(Bundle bundle, Properties properties, >+ String key) throws CoreException { >+ String value = getString(bundle, properties, key); >+ return Boolean.parseBoolean(value); >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/wizards/RemoteMainWizardPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/RemoteMainWizardPage.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/RemoteMainWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/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.wizards; >+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/wizards/DStoreServerPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/DStoreServerPage.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/DStoreServerPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/DStoreServerPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,104 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.wizards; >+ >+import org.eclipse.core.runtime.ListenerList; >+import org.eclipse.ptp.rdt.ui.wizards.DStoreServerWidget.FieldModifier; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+import org.eclipse.ptp.remote.ui.widgets.RemoteDirectoryWidget; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+ >+public class DStoreServerPage extends Composite { >+ private Text text; >+ >+ private RemoteDirectoryWidget fLocationWidget; >+ private ListenerList modifyListeners = new ListenerList(); >+ >+ public DStoreServerPage(Composite parent, int style) { >+ super(parent, style); >+ >+ GridLayout layout = new GridLayout(1, false); >+ setLayout(layout); >+ setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ fLocationWidget = new RemoteDirectoryWidget(this, SWT.NONE, "DStore Location", null); //$NON-NLS-1$ >+ fLocationWidget.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ e.data = FieldModifier.VALUE_DSTORE_LOCATION; >+ notifyListeners(e); >+ } >+ }); >+ >+ Group group = new Group(this, SWT.NONE); >+ group.setText("Server Command"); //$NON-NLS-1$ >+ group.setLayout(new GridLayout(2, false)); >+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ Composite textComp = new Composite(group, SWT.NONE); >+ textComp.setLayout(new GridLayout(2, false)); >+ textComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ Label label = new Label(textComp, SWT.NONE); >+ label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); >+ label.setText("Command:"); //$NON-NLS-1$ >+ >+ text = new Text(textComp, SWT.BORDER); >+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); >+ data.heightHint = text.getLineHeight() * 3; >+ text.setLayoutData(data); >+ text.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ e.data = FieldModifier.VALUE_DSTORE_COMMAND; >+ notifyListeners(e); >+ } >+ }); >+ } >+ >+ public void addModifyListener(ModifyListener listener) { >+ modifyListeners.add(listener); >+ } >+ >+ public String getLocationPath() { >+ return fLocationWidget.getLocationPath(); >+ } >+ >+ public String getServerCommand() { >+ return text.getText(); >+ } >+ >+ public void removeModifyListener(ModifyListener listener) { >+ modifyListeners.remove(listener); >+ } >+ >+ public void setConnection(IRemoteServices services, IRemoteConnection conn) { >+ fLocationWidget.setConnection(services, conn); >+ } >+ >+ public void setLocationPath(String path) { >+ fLocationWidget.setLocationPath(path); >+ } >+ >+ public void setServerCommand(String command) { >+ text.setText(command); >+ } >+ >+ private void notifyListeners(ModifyEvent e) { >+ for (Object listener : modifyListeners.getListeners()) { >+ ((ModifyListener)listener).modifyText(e); >+ } >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteProjectWizard.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteProjectWizard.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/NewRemoteProjectWizard.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/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.wizards; >+ >+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/subsystems/StatusMonitor.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/subsystems/StatusMonitor.java >diff -N src/org/eclipse/ptp/rdt/ui/subsystems/StatusMonitor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/subsystems/StatusMonitor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,338 @@ >+/******************************************************************************* >+ * Copyright (c) 2002, 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 >+ * >+ * Initial Contributors: >+ * The following IBM employees contributed to the Remote System Explorer >+ * component that contains this file: David McKnight, Kushal Munir, >+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, >+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. >+ * >+ * Contributors: >+ * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin >+ * David McKnight (IBM) - [225902] [dstore] use C_NOTIFICATION command to wake up the server >+ * David McKnight (IBM) - [229947] [dstore] interruption to Thread.sleep() should not stop waitForUpdate() >+ * David McKnight (IBM) - [231126] [dstore] status monitor needs to reset WaitThreshold on nudge >+ * David McKnight (IBM) - [278341] [dstore] Disconnect on idle causes the client hang >+ *******************************************************************************/ >+ >+package org.eclipse.ptp.rdt.ui.subsystems; >+ >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.dstore.core.model.DE; >+import org.eclipse.dstore.core.model.DataElement; >+import org.eclipse.dstore.core.model.DataStore; >+import org.eclipse.dstore.core.model.DataStoreSchema; >+import org.eclipse.dstore.extra.DomainEvent; >+import org.eclipse.dstore.extra.IDomainListener; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteConnectionChangeEvent; >+import org.eclipse.ptp.remote.core.IRemoteConnectionChangeListener; >+import org.eclipse.swt.widgets.Display; >+ >+/* >+ * This utility class can be used to monitor the status of one more more status DataElements. >+ * Only one instanceof of this class is required per DataStore for use in monitoring statuses. >+ * This is intended to be used in place of StatusChangeListeners >+ * >+ * * <p> >+ * The following is one example of the use of the StatusMonitor. The code: >+ * <blockquote><pre> >+ * DataElement status = dataStore.command(dsCmd, args, deObj); >+ * >+ * StatusMonitor smon = StatusMonitorFactory.getInstance().getStatusMonitorFor(getSystem(), ds); >+ * smon.waitForUpdate(status, monitor); >+ * </pre></blockquote> >+ */ >+public class StatusMonitor implements IDomainListener, IRemoteConnectionChangeListener { >+ >+ private static Map<IRemoteConnection, StatusMonitor> fMonitors = new HashMap<IRemoteConnection, StatusMonitor>(); >+ >+ public static StatusMonitor getStatusMonitorFor(IRemoteConnection connection, DataStore store) { >+ StatusMonitor monitor = fMonitors.get(connection); >+ if (monitor == null) { >+ monitor = new StatusMonitor(connection, store); >+ fMonitors.put(connection, monitor); >+ } >+ return monitor; >+ } >+ >+ protected IRemoteConnection fRemoteConnection; >+ >+ protected boolean fNetworkDown = false; >+ >+ protected List<DataElement> fWorkingStatuses = new ArrayList<DataElement>(); >+ protected List<DataElement> fCancelledStatuses = new ArrayList<DataElement>(); >+ protected List<DataElement> fDoneStatuses = new ArrayList<DataElement>(); >+ >+ protected DataStore fDataStore; >+ >+ /** >+ * Construct a StatusChangeListener >+ * >+ * @param system >+ * the system associated with this monitor >+ * @param dataStore >+ * the dataStore associated with this monitor >+ */ >+ public StatusMonitor(IRemoteConnection connection, DataStore dataStore) { >+ fRemoteConnection = connection; >+ fDataStore = dataStore; >+ reInit(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.remote.core.IRemoteConnectionChangeListener#connectionChanged(org.eclipse.ptp.remote.core.IRemoteConnectionChangeEvent) >+ */ >+ public void connectionChanged(IRemoteConnectionChangeEvent e) { >+ if (e.getType() == IRemoteConnectionChangeEvent.CONNECTION_CLOSED || >+ e.getType() == IRemoteConnectionChangeEvent.CONNECTION_ABORTED) { >+ fNetworkDown = true; >+ } >+ } >+ >+ public void dispose() { >+ fRemoteConnection.removeConnectionChangeListener(this); >+ fWorkingStatuses.clear(); >+ fDoneStatuses.clear(); >+ fCancelledStatuses.clear(); >+ fDataStore.getDomainNotifier().removeDomainListener(this); >+ } >+ >+ /** >+ * @see IDomainListener#domainChanged(DomainEvent) >+ */ >+ public void domainChanged(DomainEvent event) { >+ if (fWorkingStatuses.size() == 0) { >+ return; >+ } >+ >+ DataElement parent = (DataElement) event.getParent(); >+ if (fWorkingStatuses.contains(parent)) { >+ boolean isStatusDone = determineStatusDone(parent); >+ if (isStatusDone) { >+ setDone(parent); >+ } >+ } >+ } >+ >+ public DataStore getDataStore() { >+ return fDataStore; >+ } >+ >+ /** >+ * Test if the StatusChangeListener returned because the network connection >+ * to the remote system was broken. >+ */ >+ public boolean isNetworkDown() { >+ return fNetworkDown; >+ } >+ >+ /** >+ * @see IDomainListener#listeningTo(DomainEvent) >+ */ >+ public boolean listeningTo(DomainEvent event) { >+ if (fWorkingStatuses.size() == 0) { >+ return true; >+ } >+ >+ DataElement parent = (DataElement) event.getParent(); >+ if (fWorkingStatuses.contains(parent)) { >+ return determineStatusDone(parent); >+ } >+ >+ return false; >+ } >+ >+ public void reInit() { >+ fNetworkDown = false; >+ fRemoteConnection.addConnectionChangeListener(this); >+ fWorkingStatuses.clear(); >+ fDoneStatuses.clear(); >+ fCancelledStatuses.clear(); >+ fDataStore.getDomainNotifier().addDomainListener(this); >+ } >+ >+ public synchronized void setCancelled(DataElement status) { >+ fWorkingStatuses.remove(status); >+ fCancelledStatuses.add(status); >+ } >+ >+ /** >+ * setDone(boolean) >+ */ >+ public synchronized void setDone(DataElement status) { >+ fWorkingStatuses.remove(status); >+ fDoneStatuses.add(status); >+ } >+ >+ public synchronized void setWorking(DataElement status) { >+ fWorkingStatuses.add(status); >+ } >+ >+ public DataElement waitForUpdate(DataElement status) throws InterruptedException { >+ return waitForUpdate(status, null, 0); >+ } >+ >+ public DataElement waitForUpdate(DataElement status, int wait) throws InterruptedException { >+ return waitForUpdate(status, null, wait); >+ } >+ >+ public DataElement waitForUpdate(DataElement status, IProgressMonitor monitor) throws InterruptedException { >+ return waitForUpdate(status, monitor, 0); >+ } >+ >+ public synchronized DataElement waitForUpdate(DataElement status, IProgressMonitor monitor, int wait) >+ throws InterruptedException { >+ if (fNetworkDown && status.getDataStore().isConnected()) { >+ reInit(); >+ } >+ if (determineStatusDone(status)) { >+ setDone(status); >+ return status; >+ } >+ >+ setWorking(status); >+ >+ Display display = Display.getCurrent(); >+ >+ // Prevent infinite looping by introducing a threshold for wait >+ >+ int WaitThreshold = 50; >+ if (wait > 0) >+ WaitThreshold = wait * 10; // 1 second means 10 sleep(100ms) >+ else if (wait == -1) // force a diagnostic >+ WaitThreshold = -1; >+ >+ int initialWaitThreshold = WaitThreshold; >+ int nudges = 0; // nudges used for waking up server with slow >+ // connections >+ // nudge up to 12 times before giving up >+ >+ if (display != null) { >+ // Current thread is UI thread >+ while (fWorkingStatuses.contains(status)) { >+ // while (display.readAndDispatch()) { >+ // Process everything on event queue >+ // } >+ >+ if ((monitor != null) && (monitor.isCanceled())) { >+ setCancelled(status); >+ throw new InterruptedException(); >+ } >+ >+ boolean statusDone = determineStatusDone(status); >+ >+ if (statusDone) { >+ setDone(status); >+ } else { >+ try { >+ Thread.sleep(100); >+ } catch (InterruptedException e) { >+ // Continue waiting in case of spurious interrupt. >+ // We check the progress monitor to listen for Eclipse >+ // Shutdown. >+ continue; >+ } >+ if (WaitThreshold > 0) // update timer count if >+ // threshold not reached >+ --WaitThreshold; // decrement the timer count >+ >+ if (WaitThreshold == 0) { >+ wakeupServer(status); >+ >+ // no diagnostic factory but there is a timeout >+ if (nudges >= 12) >+ return status; // returning the undone status object >+ >+ nudges++; >+ WaitThreshold = initialWaitThreshold; >+ } else if (fNetworkDown || !fDataStore.isConnected()) { >+ dispose(); >+ throw new InterruptedException(); >+ } >+ } >+ } >+ >+ } else { >+ // Current thread is not UI thread >+ while (fWorkingStatuses.contains(status)) { >+ >+ if ((monitor != null) && (monitor.isCanceled())) { >+ setCancelled(status); >+ throw new InterruptedException(); >+ } >+ >+ boolean statusDone = determineStatusDone(status); >+ >+ if (statusDone) { >+ setDone(status); >+ } else { >+ try { >+ Thread.sleep(100); >+ } catch (InterruptedException e) { >+ // Continue waiting in case of spurious interrupt. >+ // We check the progress monitor to listen for Eclipse >+ // Shutdown. >+ continue; >+ } >+ >+ if (WaitThreshold > 0) // update timer count if >+ // threshold not reached >+ --WaitThreshold; // decrement the timer count >+ >+ if (WaitThreshold == 0) { >+ wakeupServer(status); >+ >+ // no diagnostic factory but there is a timeout >+ if (nudges >= 12) >+ return status; // returning the undone status object >+ >+ nudges++; >+ WaitThreshold = initialWaitThreshold; >+ } else if (fNetworkDown) { >+ dispose(); >+ throw new InterruptedException(); >+ } >+ } >+ } >+ } >+ >+ return status; >+ } >+ >+ public boolean wasCancelled(DataElement status) { >+ if (fCancelledStatuses.contains(status)) { >+ return true; >+ } >+ return false; >+ } >+ >+ private void wakeupServer(DataElement status) { >+ if (status != null) { >+ // token command to wake up update handler >+ DataElement cmdDescriptor = fDataStore.findCommandDescriptor(DataStoreSchema.C_NOTIFICATION); >+ DataElement subject = status.getParent().get(0); >+ if (cmdDescriptor != null) { >+ fDataStore.command(cmdDescriptor, subject); >+ } >+ } >+ } >+ >+ /** >+ * Determines whether the status is done. >+ * >+ * @return <code>true</code> if status done, <code>false</code> otherwise. >+ */ >+ protected boolean determineStatusDone(DataElement status) { >+ return status.getAttribute(DE.A_VALUE).equals("done") || status.getAttribute(DE.A_NAME).equals("done"); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/subsystems/RemoteCIndexSubsystem2.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/subsystems/RemoteCIndexSubsystem2.java >diff -N src/org/eclipse/ptp/rdt/ui/subsystems/RemoteCIndexSubsystem2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/subsystems/RemoteCIndexSubsystem2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1057 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 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 - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.subsystems; >+ >+import java.io.IOException; >+import java.lang.reflect.InvocationTargetException; >+import java.net.URI; >+import java.net.URISyntaxException; >+import java.util.ArrayList; >+import java.util.Collections; >+import java.util.HashSet; >+import java.util.Iterator; >+import java.util.LinkedList; >+import java.util.List; >+import java.util.Set; >+ >+import org.eclipse.cdt.core.CCProjectNature; >+import org.eclipse.cdt.core.CProjectNature; >+import org.eclipse.cdt.core.index.IIndexFileLocation; >+import org.eclipse.cdt.core.model.CModelException; >+import org.eclipse.cdt.core.model.CoreModelUtil; >+import org.eclipse.cdt.core.model.ICContainer; >+import org.eclipse.cdt.core.model.ICElement; >+import org.eclipse.cdt.core.model.ICProject; >+import org.eclipse.cdt.core.model.IParent; >+import org.eclipse.cdt.core.model.ITranslationUnit; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IResourceVisitor; >+import org.eclipse.core.resources.IWorkspace; >+import org.eclipse.core.resources.IWorkspaceRoot; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.AssertionFailedException; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.dstore.core.model.DataElement; >+import org.eclipse.dstore.core.model.DataStore; >+import org.eclipse.dstore.core.model.DataStoreResources; >+import org.eclipse.dstore.core.model.DataStoreSchema; >+import org.eclipse.ptp.internal.rdt.core.IRemoteIndexerInfoProvider; >+import org.eclipse.ptp.internal.rdt.core.Serializer; >+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.contentassist.Proposal; >+import org.eclipse.ptp.internal.rdt.core.contentassist.RemoteContentAssistInvocationContext; >+import org.eclipse.ptp.internal.rdt.core.includebrowser.IIndexIncludeValue; >+import org.eclipse.ptp.internal.rdt.core.index.RemoteIndexerProgress; >+import org.eclipse.ptp.internal.rdt.core.index.RemoteIndexerTask; >+import org.eclipse.ptp.internal.rdt.core.miners.CDTMiner; >+import org.eclipse.ptp.internal.rdt.core.model.Scope; >+import org.eclipse.ptp.internal.rdt.core.navigation.OpenDeclarationResult; >+import org.eclipse.ptp.internal.rdt.core.search.RemoteSearchMatch; >+import org.eclipse.ptp.internal.rdt.core.search.RemoteSearchQuery; >+import org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem; >+import org.eclipse.ptp.internal.rdt.core.typehierarchy.THGraph; >+import org.eclipse.ptp.rdt.core.RDTLog; >+import org.eclipse.ptp.rdt.core.resources.RemoteNature; >+import org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider; >+import org.eclipse.ptp.rdt.ui.messages.Messages; >+import org.eclipse.ptp.rdt.ui.serviceproviders.RemoteCIndexServiceProvider2; >+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; >+ >+/** >+ * An RSE subsystem which is used to provide C/C++ indexing services from a Miner >+ * running on a remote host. >+ * <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 RemoteCIndexSubsystem2 implements ICIndexSubsystem { >+ >+ private Set<IProject> fInitializedProjects = new HashSet<IProject>(); >+ private ProjectChangeListener fProjectOpenListener = new ProjectChangeListener(this); >+ private final RemoteCIndexServiceProvider2 fProvider; >+ private DStoreServerRunner fDataStoreRunner = null; >+ >+ public RemoteCIndexSubsystem2(RemoteCIndexServiceProvider2 provider) { >+// fRemoteServices = services; >+// fRemoteConnection = connection; >+ fProvider = provider; >+ ResourcesPlugin.getWorkspace().addResourceChangeListener(fProjectOpenListener); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#checkAllProjects(org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public void checkAllProjects(IProgressMonitor monitor) { >+ IWorkspace workspace = ResourcesPlugin.getWorkspace(); >+ IWorkspaceRoot workspaceRoot = workspace.getRoot(); >+ >+ for (IProject project : workspaceRoot.getProjects()) { >+ // is the project open? if not, there's not much we can do >+ if (!project.isOpen()) >+ continue; >+ >+ // is this an RDT C/C++ project? >+ // check the project natures... we care about the project if it has >+ // both the remote nature and >+ // at least one of the CDT natures >+ try { >+ if (!project.hasNature(RemoteNature.REMOTE_NATURE_ID) >+ || !(project.hasNature(CProjectNature.C_NATURE_ID) >+ || project.hasNature(CCProjectNature.CC_NATURE_ID))) >+ continue; >+ >+ checkProject(project, monitor); >+ } catch (Throwable e) { >+ RDTLog.logError(e); >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#checkProject(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public void checkProject(IProject project, IProgressMonitor monitor) { >+ if (project == null || fInitializedProjects.contains(project)) { >+ return; >+ } >+ try { >+ initializeScope(project, monitor); >+ } catch (CoreException e) { >+ RDTLog.logError(e); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#computeCompletionProposals(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.ptp.internal.rdt.core.contentassist.RemoteContentAssistInvocationContext, org.eclipse.cdt.core.model.ITranslationUnit) >+ */ >+ public List<Proposal> computeCompletionProposals(Scope scope, RemoteContentAssistInvocationContext context, ITranslationUnit unit) { >+ DataStore dataStore = getDataStore(); >+ if (dataStore == null) >+ { >+ return Collections.emptyList(); >+ } >+ >+ DataElement queryCmd = dataStore.localDescriptorQuery(dataStore.getDescriptorRoot(), CDTMiner.C_CONTENT_ASSIST_COMPUTE_PROPOSALS); >+ >+ if (queryCmd == null) >+ { >+ return Collections.emptyList(); >+ } >+ >+ NullProgressMonitor monitor = new NullProgressMonitor(); >+ StatusMonitor smonitor = StatusMonitor.getStatusMonitorFor(fProvider.getRemoteConnection(), dataStore); >+ ArrayList<Object> args = new ArrayList<Object>(); >+ >+ // need to know the scope >+ DataElement dataElement = dataStore.createObject(null, CDTMiner.T_SCOPE_SCOPENAME_DESCRIPTOR, scope.getName()); >+ args.add(dataElement); >+ >+ // invocation context >+ args.add(createSerializableElement(dataStore, context)); >+ >+ // translation unit >+ args.add(createSerializableElement(dataStore, unit)); >+ >+ // execute the command >+ DataElement status = dataStore.command(queryCmd, args, dataStore.getDescriptorRoot()); >+ >+ try >+ { >+ smonitor.waitForUpdate(status, monitor); >+ if (monitor.isCanceled()) >+ { >+ cancelOperation(monitor, status.getParent()); >+ } >+ } >+ catch (Exception e) >+ { >+ RDTLog.logError(e); >+ } >+ >+ DataElement element = status.get(0); >+ String data = element.getName(); >+ try >+ { >+ Object result = Serializer.deserialize(data); >+ if (result == null || !(result instanceof List<?>)) >+ { >+ return Collections.emptyList(); >+ } >+ return (List<Proposal>) result; >+ } catch (IOException e) { >+ RDTLog.logError(e); >+ } catch (ClassNotFoundException e) { >+ RDTLog.logError(e); >+ } >+ return Collections.emptyList(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#computeTypeGraph(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.model.ICElement, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public THGraph computeTypeGraph(Scope scope, ICElement input, IProgressMonitor monitor) { >+ Object result = sendRequest(CDTMiner.C_TYPE_HIERARCHY_COMPUTE_TYPE_GRAPH, new Object[] { scope, getBaseURI(), input }, monitor); >+ if (result == null) { >+ return new THGraph(); >+ } >+ return (THGraph) result; >+ } >+ >+ /** >+ * Shutdown and clean up the subsystem >+ */ >+ public void dispose() { >+ if (fDataStoreRunner != null) { >+ fDataStoreRunner.cancel(); >+ } >+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(fProjectOpenListener); >+ } >+ >+ // scope management >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#findInclude(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.index.IIndexFileLocation, java.lang.String, int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IIndexIncludeValue findInclude(Scope scope, IIndexFileLocation location, String name, int offset, IProgressMonitor monitor) >+ { >+ Object result = sendRequest(CDTMiner.C_INCLUDES_FIND_INCLUDE, new Object[] { scope, getBaseURI(), location, name, offset}, monitor); >+ if (result == null) >+ { >+ return null; >+ } >+ >+ return (IIndexIncludeValue) result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#findIncludedBy(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.index.IIndexFileLocation, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IIndexIncludeValue[] findIncludedBy(Scope scope, IIndexFileLocation location, IProgressMonitor monitor) >+ { >+ Object result = sendRequest(CDTMiner.C_INCLUDES_FIND_INCLUDED_BY, new Object[] { scope, getBaseURI(), location }, monitor); >+ if (result == null) >+ { >+ return new IIndexIncludeValue[0]; >+ } >+ >+ return (IIndexIncludeValue[]) result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#findIncludesTo(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.index.IIndexFileLocation, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IIndexIncludeValue[] findIncludesTo(Scope scope, IIndexFileLocation location, IProgressMonitor monitor) >+ { >+ Object result = sendRequest(CDTMiner.C_INCLUDES_FIND_INCLUDES_TO, new Object[] { scope, getBaseURI(), location }, monitor); >+ if (result == null) >+ { >+ return new IIndexIncludeValue[0]; >+ } >+ >+ return (IIndexIncludeValue[]) result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#findTypeHierarchyInput(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.model.ICElement) >+ */ >+ public ICElement[] findTypeHierarchyInput(Scope scope, ICElement memberInput) { >+ Object result = sendRequest(CDTMiner.C_TYPE_HIERARCHY_FIND_INPUT1, new Object[] { scope, getBaseURI(), memberInput }, null); >+ if (result == null) { >+ return new ICElement[] { null, null }; >+ } >+ return (ICElement[]) result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#findTypeHierarchyInput(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.model.ITranslationUnit, int, int) >+ */ >+ public ICElement[] findTypeHierarchyInput(Scope scope, ITranslationUnit unit, int selectionStart, int selectionLength) { >+ Object result = sendRequest(CDTMiner.C_TYPE_HIERARCHY_FIND_INPUT2, new Object[] { scope, getBaseURI(), unit, new Integer(selectionStart), new Integer(selectionLength)}, null); >+ if (result == null) { >+ return new ICElement[] { null, null }; >+ } >+ return (ICElement[]) result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#getCallees(org.eclipse.ptp.internal.rdt.core.model.Scope, java.lang.String, java.lang.String, int, int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public CallsToResult getCallees(Scope scope, ICElement subject, IProgressMonitor monitor) { >+ monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.6") + subject, 100); //$NON-NLS-1$ >+ Object result = sendRequest(CDTMiner.C_CALL_HIERARCHY_GET_CALLS, new Object[] { scope, getBaseURI(), subject }, null); >+ if (result == null) { >+ return new CallsToResult(); >+ } >+ return (CallsToResult) result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#getCallers(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.model.ICElement, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public CalledByResult getCallers(Scope scope, ICElement subject, IProgressMonitor monitor) { >+ monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.5") + subject, 100); //$NON-NLS-1$ >+ Object result = sendRequest(CDTMiner.C_CALL_HIERARCHY_GET_CALLERS, new Object[] { scope, getBaseURI(), subject }, null); >+ if (result == null) { >+ return new CalledByResult(); >+ } >+ return (CalledByResult) result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#getCHDefinitions(org.eclipse.ptp.internal.rdt.core.model.Scope, java.lang.String, java.lang.String, int, int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public ICElement[] getCHDefinitions(Scope scope, ICElement subject, IProgressMonitor monitor) { >+ monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.7") + subject, 100); //$NON-NLS-1$ >+ Object result = sendRequest(CDTMiner.C_CALL_HIERARCHY_GET_DEFINITIONS_FROM_ELEMENT, new Object[] { scope, getBaseURI(), subject }, null); >+ if (result == null) { >+ return new ICElement[0]; >+ } >+ return (ICElement[]) result; >+ } >+ >+ // call hierarchy >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#getCHDefinitions(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.model.ITranslationUnit, int, int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public ICElement[] getCHDefinitions(Scope scope, ITranslationUnit unit, int selectionStart, int selectionLength, IProgressMonitor monitor) { >+ monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.7") + unit, 100); //$NON-NLS-1$ >+ Object result = sendRequest(CDTMiner.C_CALL_HIERARCHY_GET_DEFINITIONS_FROM_WORKING_COPY, new Object[] { scope, getBaseURI(), unit, selectionStart, selectionLength }, null); >+ if (result == null) { >+ return new ICElement[0]; >+ } >+ return (ICElement[]) result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#getModel(org.eclipse.cdt.core.model.ITranslationUnit, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public ITranslationUnit getModel(ITranslationUnit unit, IProgressMonitor monitor) { >+ Object result = sendRequest(CDTMiner.C_MODEL_BUILDER, new Object[] {unit}, monitor); >+ if (result == null) >+ { >+ return null; >+ } >+ >+ //the working copy >+ return (ITranslationUnit) result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#indexDelta(org.eclipse.ptp.internal.rdt.core.model.Scope, java.util.List, java.util.List, java.util.List, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IStatus indexDelta(Scope scope, >+ IRemoteIndexerInfoProvider provider, >+ List<ICElement> newElements, List<ICElement> changedElements, >+ List<ICElement> deletedElements, IProgressMonitor monitor, >+ RemoteIndexerTask task) { >+ DataStore dataStore = getDataStore(); >+ >+ if (dataStore != null) >+ { >+ >+ DataElement result = getDataStore().createObject(null, CDTMiner.T_INDEX_STATUS_DESCRIPTOR, "index"); //$NON-NLS-1$ >+ StatusMonitor smonitor = StatusMonitor.getStatusMonitorFor(fProvider.getRemoteConnection(), dataStore); >+ >+ int workCount = newElements.size() + changedElements.size(); >+ >+ monitor.beginTask("Incrementally Indexing...", workCount); //$NON-NLS-1$ >+ >+ DataElement queryCmd = dataStore.localDescriptorQuery(dataStore.getDescriptorRoot(), CDTMiner.C_INDEX_DELTA); >+ if (queryCmd != null) >+ { >+ >+ ArrayList<Object> args = new ArrayList<Object>(); >+ >+ // need to know the scope >+ DataElement scopeElement = dataStore.createObject(null, CDTMiner.T_SCOPE_SCOPENAME_DESCRIPTOR, scope.getName()); >+ args.add(scopeElement); >+ >+ >+ String serializedProvider = null; >+ try { >+ serializedProvider = Serializer.serialize(provider); >+ } catch (IOException e) { >+ RDTLog.logError(e); >+ } >+ >+ DataElement providerElement = dataStore.createObject(null, CDTMiner.T_INDEX_SCANNER_INFO_PROVIDER, serializedProvider); >+ args.add(providerElement); >+ >+ >+ // iterate through the additions and create an object for each addition >+ Iterator<ICElement> iterator = newElements.iterator(); >+ >+ while(iterator.hasNext()) { >+ ICElement element = iterator.next(); >+ >+ // figure out the path to the element on the remote machine >+ String remotePath = convertURIToRemotePath(element.getLocationURI()); >+ >+ DataElement addedElement = dataStore.createObject(null, CDTMiner.T_INDEX_DELTA_ADDED, remotePath); >+ args.add(addedElement); >+ } >+ >+ // iterate through the changed elements and create an object for each change >+ iterator = changedElements.iterator(); >+ >+ while(iterator.hasNext()) { >+ ICElement element = iterator.next(); >+ >+ // figure out the path to the element on the remote machine >+ String remotePath = convertURIToRemotePath(element.getLocationURI()); >+ >+ DataElement changedElement = dataStore.createObject(null, CDTMiner.T_INDEX_DELTA_CHANGED, remotePath); >+ args.add(changedElement); >+ } >+ >+ // iterate through the deleted elements and create an object for each change >+ iterator = deletedElements.iterator(); >+ >+ while(iterator.hasNext()) { >+ ICElement element = iterator.next(); >+ >+ // figure out the path to the element on the remote machine >+ String remotePath = convertURIToRemotePath(element.getLocationURI()); >+ >+ DataElement deletedElement = dataStore.createObject(null, CDTMiner.T_INDEX_DELTA_REMOVED, remotePath); >+ args.add(deletedElement); >+ } >+ >+ DataElement status = dataStore.command(queryCmd, args, result); >+ >+ //poll for progress information until the operation is done or canceled >+ while (!status.getName().equals("done") && !status.getName().equals("cancelled") && !monitor.isCanceled()) { //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ RemoteIndexerProgress progress = getIndexerProgress(status); >+ task.updateProgressInformation(progress); >+ try { >+ Thread.sleep(100); >+ } catch (InterruptedException e) { >+ RDTLog.logError(e); >+ } >+ } >+ >+ try { >+ smonitor.waitForUpdate(status, monitor); >+ if (monitor.isCanceled()) >+ cancelOperation(monitor, status.getParent()); >+ } catch (Exception e) { >+ RDTLog.logError(e); >+ } >+ >+ monitor.done(); >+ } >+ } >+ >+ return Status.OK_STATUS; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#isIndexed(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.index.IIndexFileLocation, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public boolean isIndexed(Scope scope, IIndexFileLocation location, IProgressMonitor monitor) >+ { >+ Object result = sendRequest(CDTMiner.C_INCLUDES_IS_INDEXED, new Object[] { scope, getBaseURI(), location }, monitor); >+ if (result != null) >+ { >+ return Boolean.parseBoolean(result.toString()); >+ } >+ >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#moveIndexFile(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public String moveIndexFile(String scopeName, String newIndexLocation, IProgressMonitor monitor) { >+ String actualLocation = sendRequestStringResult(CDTMiner.C_MOVE_INDEX_FILE, new Object[] {scopeName, newIndexLocation}, monitor); >+ return actualLocation; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#openDeclaration(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.cdt.core.model.ITranslationUnit, java.lang.String, int, int, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public OpenDeclarationResult openDeclaration(Scope scope, ITranslationUnit unit, String selectedText, int selectionStart, int selectionLength, IProgressMonitor monitor) { >+ monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.9"), 100); //$NON-NLS-1$ >+ Object result = sendRequest(CDTMiner.C_NAVIGATION_OPEN_DECLARATION, new Object[] {scope, unit, selectedText, selectionStart, selectionLength}, monitor); >+ if(result == null) >+ return OpenDeclarationResult.failureUnexpectedError(); >+ return (OpenDeclarationResult)result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#registerScope(org.eclipse.ptp.internal.rdt.core.model.Scope, java.lang.String[], org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IStatus registerScope(Scope scope, List<ICElement> elements, String configLocation, IProgressMonitor monitor) >+ { >+ DataStore dataStore = getDataStore(); >+ >+ if (dataStore != null) >+ { >+ >+ StatusMonitor smonitor = StatusMonitor.getStatusMonitorFor(fProvider.getRemoteConnection(), dataStore); >+ >+ monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.3"), 100); //$NON-NLS-1$ >+ >+ DataElement queryCmd = dataStore.localDescriptorQuery(dataStore.getDescriptorRoot(), CDTMiner.C_SCOPE_REGISTER); >+ if (queryCmd != null) >+ { >+ >+ ArrayList<Object> args = new ArrayList<Object>(); >+ >+ // need to know the scope >+ DataElement scopeElement = dataStore.createObject(null, CDTMiner.T_SCOPE_SCOPENAME_DESCRIPTOR, scope.getName()); >+ args.add(scopeElement); >+ >+ // need to know where to find the pdom file for the scope >+ DataElement configElement = dataStore.createObject(null, CDTMiner.T_SCOPE_CONFIG_LOCATION, configLocation); >+ args.add(configElement); >+ >+ // add in the filenames >+ for(ICElement element : elements) { >+ addElement(dataStore, args, element); >+ } >+ >+ // execute the command >+ DataElement status = dataStore.command(queryCmd, args, dataStore.getDescriptorRoot()); >+ >+ try >+ { >+ smonitor.waitForUpdate(status, monitor); >+ if (monitor.isCanceled()) >+ { >+ cancelOperation(monitor, status.getParent()); >+ } >+ } >+ catch (Exception e) >+ { >+ } >+ >+ int i=0; >+ i++; >+ } >+ >+ >+ } >+ >+ return Status.OK_STATUS; >+ >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#reindexScope(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.ptp.internal.rdt.core.IRemoteIndexerInfoProvider, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ptp.internal.rdt.core.index.RemoteIndexerTask) >+ */ >+ public IStatus reindexScope(Scope scope, IRemoteIndexerInfoProvider provider, String indexLocation, IProgressMonitor monitor, RemoteIndexerTask task) >+ { >+ DataStore dataStore = getDataStore(); >+ >+ if (dataStore != null) >+ { >+ >+ DataElement result = getDataStore().createObject(null, CDTMiner.T_INDEX_STATUS_DESCRIPTOR, "index"); //$NON-NLS-1$ >+ StatusMonitor smonitor = StatusMonitor.getStatusMonitorFor(fProvider.getRemoteConnection(), dataStore); >+ >+// int count = 0; >+// DataElement countCmd = dataStore.localDescriptorQuery(datastore.getDescriptorRoot(), CDTMiner.C_SCOPE_COUNT_ELEMENTS); >+// if (countCmd != null) >+// { >+// DataElement countStatus = dataStore.command(countCmd, result, true); >+// try >+// { >+// smonitor.waitForUpdate(countStatus, monitor, 5000); >+// if (monitor.isCanceled()) >+// { >+// cancelOperation(monitor, countStatus.getParent()); >+// } >+// } >+// catch (Exception e) >+// { >+// } >+// count = Integer.parseInt(countStatus.getSource()); >+// } >+// >+// monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.1"), count); //$NON-NLS-1$ >+ >+ monitor.beginTask("Rebuilding indexing...", 100); //$NON-NLS-1$ >+ >+ DataElement queryCmd = dataStore.localDescriptorQuery(dataStore.getDescriptorRoot(), CDTMiner.C_INDEX_REINDEX); >+ if (queryCmd != null) >+ { >+ >+ ArrayList<Object> args = new ArrayList<Object>(); >+ >+ // need to know the scope >+ DataElement scopeElement = dataStore.createObject(null, CDTMiner.T_SCOPE_SCOPENAME_DESCRIPTOR, scope.getName()); >+ args.add(scopeElement); >+ >+ String serializedProvider = null; >+ try { >+ serializedProvider = Serializer.serialize(provider); >+ } catch (IOException e) { >+ RDTLog.logError(e); >+ } >+ >+ DataElement providerElement = dataStore.createObject(null, CDTMiner.T_INDEX_SCANNER_INFO_PROVIDER, serializedProvider); >+ args.add(providerElement); >+ >+ // need to know the scope config location >+ DataElement indexLocationElement = dataStore.createObject(null, CDTMiner.T_SCOPE_CONFIG_LOCATION, indexLocation); >+ args.add(indexLocationElement); >+ >+ DataElement status = dataStore.command(queryCmd, args, result); >+ >+ //poll for progress information until the operation is done or canceled >+ while (!status.getName().equals("done") && !status.getName().equals("cancelled") && !monitor.isCanceled()) { //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ RemoteIndexerProgress progress = getIndexerProgress(status); >+ task.updateProgressInformation(progress); >+ try { >+ Thread.sleep(100); >+ } catch (InterruptedException e) { >+ RDTLog.logError(e); >+ } >+ } >+ >+ try { >+ smonitor.waitForUpdate(status, monitor); >+ if (monitor.isCanceled()) >+ cancelOperation(monitor, status.getParent()); >+ } catch (Exception e) { >+ RDTLog.logError(e); >+ } >+ >+ monitor.done(); >+ } >+ } >+ >+ return Status.OK_STATUS; >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#removeIndexFile(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IStatus removeIndexFile(Scope scope, IProgressMonitor monitor) { >+ sendRequest(CDTMiner.C_REMOVE_INDEX_FILE, new Object[] {scope}, monitor); >+ return Status.OK_STATUS; >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#runQuery(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.ptp.internal.rdt.core.search.RemoteSearchQuery, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ @SuppressWarnings("unchecked") >+ public List<RemoteSearchMatch> runQuery(Scope scope, RemoteSearchQuery query, IProgressMonitor monitor) { >+ monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.8") + query.getScopeDescription(), 100); //$NON-NLS-1$ >+ Object result = sendRequest(CDTMiner.C_SEARCH_RUN_QUERY, new Object[] { scope, getBaseURI(), query }, null); >+ if (result == null) { >+ return Collections.emptyList(); >+ } >+ return (List<RemoteSearchMatch>) result; >+ } >+ >+ /** >+ * @param requestType >+ * @param arguments >+ * @param monitor >+ * @return >+ */ >+ public Object sendRequest(String requestType, Object[] arguments, IProgressMonitor monitor) { >+ return sendRequest(requestType, arguments, monitor, true); >+ } >+ >+ /** >+ * @param requestType >+ * @param arguments >+ * @param monitor >+ * @return >+ */ >+ public String sendRequestStringResult(String requestType, Object[] arguments, IProgressMonitor monitor) { >+ return (String) sendRequest(requestType, arguments, monitor, false); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#startIndexOfScope(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IStatus startIndexOfScope(Scope scope, IRemoteIndexerInfoProvider provider, IProgressMonitor monitor) >+ { >+ DataStore dataStore = getDataStore(); >+ >+ if (dataStore != null) >+ { >+ >+ StatusMonitor smonitor = StatusMonitor.getStatusMonitorFor(fProvider.getRemoteConnection(), dataStore); >+ >+ monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.0"), 100); //$NON-NLS-1$ >+ >+ DataElement queryCmd = dataStore.localDescriptorQuery(dataStore.getDescriptorRoot(), CDTMiner.C_INDEX_START); >+ if (queryCmd != null) >+ { >+ >+ ArrayList<Object> args = new ArrayList<Object>(); >+ >+ // need to know the scope >+ DataElement scopeElement = dataStore.createObject(null, CDTMiner.T_SCOPE_SCOPENAME_DESCRIPTOR, scope.getName()); >+ args.add(scopeElement); >+ >+ String serializedProvider = null; >+ try { >+ serializedProvider = Serializer.serialize(provider); >+ } catch (IOException e) { >+ RDTLog.logError(e); >+ } >+ >+ DataElement providerElement = dataStore.createObject(null, CDTMiner.T_INDEX_SCANNER_INFO_PROVIDER, serializedProvider); >+ args.add(providerElement); >+ >+ >+ // execute the command >+ //DataElement status = dataStore.command(queryCmd, dataStore.getDescriptorRoot(), true); >+ DataElement status = dataStore.command(queryCmd, args, dataStore.getDescriptorRoot()); >+ >+ try >+ { >+ smonitor.waitForUpdate(status, monitor); >+ if (monitor.isCanceled()) >+ { >+ cancelOperation(monitor, status.getParent()); >+ } >+ } >+ catch (Exception e) >+ { >+ } >+ >+ } >+ >+ } >+ >+ return Status.OK_STATUS; >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.internal.rdt.core.subsystems.ICIndexSubsystem#unregisterScope(org.eclipse.ptp.internal.rdt.core.model.Scope, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IStatus unregisterScope(Scope scope, IProgressMonitor monitor) { >+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(scope.getName()); >+ fInitializedProjects.remove(project); >+ >+ DataStore dataStore = getDataStore(); >+ >+ if (dataStore != null) >+ { >+ >+// DataElement result = dataStore.createObject(null, CDTMiner.T_INDEX_STATUS_DESCRIPTOR, name); >+// DataElement statusDescriptor = dataStore.createObjectDescriptor(null, CDTMiner.T_INDEX_STATUS_DESCRIPTOR); >+ >+// result.setDescriptor(statusDescriptor); >+ >+ StatusMonitor smonitor = StatusMonitor.getStatusMonitorFor(fProvider.getRemoteConnection(), dataStore); >+ >+ monitor.beginTask(Messages.getString("RemoteCIndexSubsystem.4"), 100); //$NON-NLS-1$ >+ >+ DataElement queryCmd = dataStore.localDescriptorQuery(dataStore.getDescriptorRoot(), CDTMiner.C_SCOPE_UNREGISTER); >+ if (queryCmd != null) >+ { >+ >+ ArrayList<Object> args = new ArrayList<Object>(); >+ >+ // need to know the scope >+ DataElement scopeElement = dataStore.createObject(null, CDTMiner.T_SCOPE_SCOPENAME_DESCRIPTOR, scope.getName()); >+ args.add(scopeElement); >+ >+ >+ // execute the command >+ //DataElement status = dataStore.command(queryCmd, dataStore.getDescriptorRoot(), true); >+ DataElement status = dataStore.command(queryCmd, args, dataStore.getDescriptorRoot()); >+ >+ try >+ { >+ smonitor.waitForUpdate(status, monitor); >+ if (monitor.isCanceled()) >+ { >+ cancelOperation(monitor, status.getParent()); >+ } >+ } >+ catch (Exception e) >+ { >+ } >+ >+ >+ } >+ >+ >+ } >+ >+ return Status.OK_STATUS; >+ } >+ >+ private DataElement createSerializableElement(DataStore dataStore, Object object) { >+ try { >+ String serialized = Serializer.serialize(object); >+ return dataStore.createObject(null, CDTMiner.T_INDEX_STRING_DESCRIPTOR, serialized); >+ } catch (IOException e) { >+ RDTLog.logError(e); >+ return null; >+ } >+ } >+ >+ private RemoteIndexerProgress getIndexerProgress(DataElement status) { >+ int num = status.getNestedSize(); >+ if (num > 0) { >+ DataElement element = status.get(num-1); >+ String data = element.getName(); >+ try >+ { >+ Object result = Serializer.deserialize(data); >+ if (result == null || !(result instanceof RemoteIndexerProgress)) >+ { >+ return null; >+ } >+ RemoteIndexerProgress info = (RemoteIndexerProgress) result; >+ return info; >+ } catch (IOException e) { >+ RDTLog.logError(e); >+ } catch (ClassNotFoundException e) { >+ RDTLog.logError(e); >+ } >+ } >+ return null; >+ } >+ >+ private void initializeScope(IProject project, IProgressMonitor monitor) throws CoreException { >+ // get the service model configuration for this project >+ final ServiceModelManager serviceModelManager = ServiceModelManager.getInstance(); >+ IServiceConfiguration config = serviceModelManager.getActiveConfiguration(project); >+ >+ // is the indexing service associated with our service provider? >+ IService service = serviceModelManager.getService(RemoteCIndexServiceProvider2.SERVICE_ID); >+ IServiceProvider provider = config.getServiceProvider(service); >+ >+ >+ // if so, initialize a scope for the project consisting of all >+ // its translation units >+ final List<ICElement> cElements = new LinkedList<ICElement>(); >+ >+ IResourceVisitor fileCollector = new IResourceVisitor() { >+ >+ public boolean visit(IResource resource) throws CoreException { >+ if (resource instanceof IFile) { >+ // add the path >+ ITranslationUnit tu = CoreModelUtil.findTranslationUnit((IFile) resource); >+ if (tu != null) { >+ cElements.add(tu); >+ return false; >+ } >+ } >+ return true; >+ } >+ }; >+ >+ // collect the translation units >+ project.accept(fileCollector); >+ >+ String configLocation = ((IIndexServiceProvider)provider).getIndexLocation(); >+ Scope scope = new Scope(project.getName()); >+ >+ // unregister the scope if there already is one >+ unregisterScope(scope, monitor); >+ >+ // register the new scope >+ registerScope(scope, cElements, configLocation, monitor); >+ >+ fInitializedProjects.add(project); >+ >+ } >+ >+ /** >+ * Sends a request in a set format of arguments. >+ * >+ * @param deserializeResult If true the result will be deserialized, if false it will treat the result as a raw string. >+ */ >+ private Object sendRequest(String requestType, Object[] arguments, IProgressMonitor monitor, boolean deserializeResult) { >+ DataStore dataStore = getDataStore(); >+ if (dataStore == null) >+ return null; >+ >+ DataElement queryCmd = dataStore.localDescriptorQuery(dataStore.getDescriptorRoot(), requestType); >+ if (queryCmd == null) >+ return null; >+ >+ StatusMonitor smonitor = StatusMonitor.getStatusMonitorFor(fProvider.getRemoteConnection(), dataStore); >+ ArrayList<Object> args = new ArrayList<Object>(); >+ >+ for (Object argument : arguments) { >+ if (argument instanceof Scope) { >+ DataElement dataElement = dataStore.createObject(null, CDTMiner.T_SCOPE_SCOPENAME_DESCRIPTOR, ((Scope) argument).getName()); >+ args.add(dataElement); >+ } else if (argument instanceof String) { >+ DataElement dataElement = dataStore.createObject(null, CDTMiner.T_INDEX_STRING_DESCRIPTOR, (String) argument); >+ args.add(dataElement); >+ } else if (argument instanceof Integer >+ || argument instanceof Boolean >+ || argument instanceof Character >+ || argument instanceof Double >+ || argument instanceof Float) { >+ DataElement dataElement = dataStore.createObject(null, CDTMiner.T_INDEX_STRING_DESCRIPTOR, argument.toString()); >+ args.add(dataElement); >+ } else { >+ args.add(createSerializableElement(dataStore, argument)); >+ } >+ } >+ >+ // execute the command >+ DataElement status = dataStore.command(queryCmd, args, dataStore.getDescriptorRoot()); >+ >+ try >+ { >+ monitor = monitor == null ? new NullProgressMonitor() : monitor; >+ smonitor.waitForUpdate(status, monitor); >+ if (monitor.isCanceled()) { >+ cancelOperation(monitor, status.getParent()); >+ } >+ } >+ catch (Exception e) { >+ RDTLog.logError(e); >+ } >+ >+ DataElement element = status.get(0); >+ if (element == null) { >+ return null; >+ } >+ >+ if(DataStoreResources.model_error.equals(element.getType())) { // Error occurred on the server >+ RDTLog.logError(status.getValue()); // prints the server error stack trace to the log >+ return null; >+ } >+ >+ String data = element.getName(); >+ if(!deserializeResult) >+ return data; >+ >+ try >+ { >+ Object result = Serializer.deserialize(data); >+ return result; >+ } catch (IOException e) { >+ RDTLog.logError(e); >+ } catch (ClassNotFoundException e) { >+ RDTLog.logError(e); >+ } >+ return null; >+ } >+ >+ >+ >+ /** >+ * @param dataStore >+ * @param args >+ * @param filePath >+ * @param element >+ */ >+ protected void addElement(DataStore dataStore, ArrayList<Object> args, ICElement element) { >+ >+ String filePath = null; >+ >+ // if it's a translation unit, we can just add it >+ if(element instanceof ITranslationUnit) { >+ filePath = convertURIToRemotePath(element.getLocationURI()); >+ } >+ >+ else { >+ // if it's a container or a project, add the child elements >+ if(element instanceof ICContainer || element instanceof ICProject) { >+ try { >+ ICElement[] children = ((IParent) element).getChildren(); >+ >+ for(int k = 0; k < children.length; k++) >+ addElement(dataStore, args, children[k]); >+ >+ } catch (CModelException e) { >+ RDTLog.logError(e); >+ } >+ } >+ >+ } >+ >+ if (filePath != null) { >+ DataElement fileElement = dataStore.createObject(null, >+ CDTMiner.T_INDEX_FILENAME_DESCRIPTOR, filePath); >+ args.add(fileElement); >+ } >+ } >+ >+ protected void cancelOperation(IProgressMonitor monitor, DataElement cmd) throws InvocationTargetException, InterruptedException >+ { >+ DataStore dataStore = cmd.getDataStore(); >+ DataElement commandDescriptor = dataStore.findCommandDescriptor(DataStoreSchema.C_CANCEL); >+ if (commandDescriptor != null) >+ { >+ dataStore.command(commandDescriptor, cmd, false, true); >+ } >+ } >+ >+ protected URI convertRemotePathToURI(String path) throws URISyntaxException { >+ return fProvider.getRemoteServices().getFileManager(fProvider.getRemoteConnection()).toURI(path); >+ } >+ >+ protected String convertURIToRemotePath(URI locationURI) { >+ return fProvider.getRemoteServices().getFileManager(fProvider.getRemoteConnection()).toPath(locationURI).toString(); >+ } >+ >+ protected String getBaseURI() { >+ try { >+ return convertRemotePathToURI("/").toString(); //$NON-NLS-1$ >+ } catch (URISyntaxException e) { >+ throw new AssertionFailedException(e.getLocalizedMessage()); >+ } >+ } >+ >+ protected DataStore getDataStore() { >+ DataStore dataStore = null; >+ if (fDataStoreRunner == null) { >+ fDataStoreRunner = DStoreServerManager.getInstance().getServer(fProvider.getRemoteServices(), fProvider.getRemoteConnection()); >+ fDataStoreRunner.setWorkDir(fProvider.getDStoreLocation()); >+ fDataStoreRunner.setCommand(fProvider.getDStoreCommand()); >+ fDataStoreRunner.setEnv(fProvider.getDStoreEnv()); >+ } >+ dataStore = fDataStoreRunner.getDataStore(); >+ if (!dataStore.isConnected()) { >+ if (fDataStoreRunner.startServer()) { >+ DataElement status = dataStore.activateMiner("org.eclipse.ptp.internal.rdt.core.miners.CDTMiner"); //$NON-NLS-1$ >+ StatusMonitor smonitor = StatusMonitor.getStatusMonitorFor(fProvider.getRemoteConnection(), dataStore); >+ try { >+ smonitor.waitForUpdate(status, new NullProgressMonitor()); >+ } catch (InterruptedException e) { >+ // Data store will be disconnected if error occurs >+ } >+ } >+ } >+ return dataStore; >+ } >+ >+} >Index: .options >=================================================================== >RCS file: .options >diff -N .options >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .options 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+# Debugging options for the org.eclipse.ptp.rdt.ui >+ >+# Also displays overall startup time. >+org.eclipse.ptp.rdt.ui/debug=false >+ >+# Enables dstore server tracing >+org.eclipse.ptp.rdt.ui/debug/dstore/tracing=false >Index: src/org/eclipse/ptp/rdt/ui/wizards/RemoteCommonProjectWizard.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/RemoteCommonProjectWizard.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/RemoteCommonProjectWizard.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/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.wizards; >+ >+ >+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.internal.ui.wizards.ICDTCommonProjectWizard; >+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.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.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/subsystems/DStoreServerManager.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerManager.java >diff -N src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/subsystems/DStoreServerManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,40 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.subsystems; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+ >+public class DStoreServerManager { >+ private final static Map<String, DStoreServerRunner> fServers = new HashMap<String, DStoreServerRunner>(); >+ >+ private static DStoreServerManager fInstance; >+ >+ public static synchronized DStoreServerManager getInstance() { >+ if(fInstance == null) { >+ fInstance = new DStoreServerManager(); >+ } >+ return fInstance; >+ } >+ >+ private String getKey(IRemoteServices services, IRemoteConnection connection) { >+ return services.getId() + connection.getName(); >+ } >+ >+ public DStoreServerRunner getServer(IRemoteServices services, IRemoteConnection connection) { >+ DStoreServerRunner server = fServers.get(getKey(services, connection)); >+ if (server == null) { >+ server = new DStoreServerRunner(services, connection); >+ fServers.put(getKey(services, connection), server); >+ } >+ return server; >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/wizards/DStoreEnvironmentPage.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/DStoreEnvironmentPage.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/DStoreEnvironmentPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/DStoreEnvironmentPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,260 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.wizards; >+ >+import org.eclipse.core.runtime.ListenerList; >+import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.window.Window; >+import org.eclipse.ptp.rdt.ui.wizards.DStoreServerWidget.FieldModifier; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+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.Control; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableColumn; >+import org.eclipse.swt.widgets.TableItem; >+import org.eclipse.swt.widgets.Text; >+ >+public class DStoreEnvironmentPage extends Composite { >+ public class EnvInputDialog extends Dialog { >+ private Text variableText; >+ private Text valueText; >+ >+ private String variable; >+ private String value; >+ >+ public EnvInputDialog(Shell parentShell) { >+ super(parentShell); >+ } >+ >+ public String getValue() { >+ return value; >+ } >+ >+ public String getVariable() { >+ return variable; >+ } >+ >+ /* >+ * (non-Javadoc) Method declared on Dialog. >+ */ >+ protected void buttonPressed(int buttonId) { >+ if (buttonId == IDialogConstants.OK_ID) { >+ value = valueText.getText(); >+ variable = variableText.getText(); >+ } else { >+ value = null; >+ variable = null; >+ } >+ super.buttonPressed(buttonId); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) >+ */ >+ protected void createButtonsForButtonBar(Composite parent) { >+ // create OK and Cancel buttons by default >+ createButton(parent, IDialogConstants.OK_ID, >+ IDialogConstants.OK_LABEL, true); >+ createButton(parent, IDialogConstants.CANCEL_ID, >+ IDialogConstants.CANCEL_LABEL, false); >+ } >+ >+ /* >+ * (non-Javadoc) Method declared on Dialog. >+ */ >+ protected Control createDialogArea(Composite parent) { >+ // create composite >+ Composite composite = (Composite) super.createDialogArea(parent); >+ // create message >+ Label variableLabel = new Label(composite, SWT.WRAP); >+ variableLabel.setText("Variable"); //$NON-NLS-1$ >+ GridData data = new GridData(GridData.GRAB_HORIZONTAL >+ | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL >+ | GridData.VERTICAL_ALIGN_CENTER); >+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); >+ variableLabel.setLayoutData(data); >+ variableLabel.setFont(parent.getFont()); >+ >+ variableText = new Text(composite, SWT.SINGLE | SWT.BORDER); >+ variableText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL >+ | GridData.HORIZONTAL_ALIGN_FILL)); >+ Label valueLabel = new Label(composite, SWT.WRAP); >+ valueLabel.setText("Variable"); //$NON-NLS-1$ >+ data = new GridData(GridData.GRAB_HORIZONTAL >+ | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL >+ | GridData.VERTICAL_ALIGN_CENTER); >+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); >+ valueLabel.setLayoutData(data); >+ valueLabel.setFont(parent.getFont()); >+ >+ valueText = new Text(composite, SWT.SINGLE | SWT.BORDER); >+ valueText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL >+ | GridData.HORIZONTAL_ALIGN_FILL)); >+ applyDialogFont(composite); >+ return composite; >+ } >+ } >+ >+ ///private final Label label; >+ private Table table; >+ private Button addButton; >+ private Button removeButton; >+ >+ private ListenerList modifyListeners = new ListenerList(); >+ >+ public DStoreEnvironmentPage(Composite parent, int style) { >+ super(parent, style); >+ >+ GridLayout layout = new GridLayout(1, false); >+ setLayout(layout); >+ setLayoutData(new GridData(GridData.FILL_BOTH)); >+ >+ Group group = new Group(this, SWT.NONE); >+ group.setText("Environment Variables"); //$NON-NLS-1$ >+ group.setLayout(new GridLayout(2, false)); >+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ Composite tableComp = new Composite(group, SWT.NONE); >+ tableComp.setLayout(new GridLayout(2, false)); >+ tableComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ table = new Table(tableComp, SWT.BORDER); >+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); >+ table.setLayoutData(data); >+ table.setHeaderVisible(true); >+ table.setLinesVisible(true); >+ >+ TableColumn col1 = new TableColumn(table, SWT.NONE); >+ col1.setText("Variable"); //$NON-NLS-1$ >+ col1.setWidth(100); >+ col1.setResizable(true); >+ >+ TableColumn col2 = new TableColumn(table, SWT.NONE); >+ col2.setText("Value"); //$NON-NLS-1$ >+ col2.setWidth(200); >+ col2.setResizable(true); >+ >+ Composite buttonComp = new Composite(group, SWT.NONE); >+ buttonComp.setLayout(new GridLayout(1, false)); >+ buttonComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true)); >+ >+ addButton = new Button(buttonComp, SWT.NONE); >+ addButton.setText("Add..."); //$NON-NLS-1$ >+ GridData addButtonData = new GridData(SWT.FILL, SWT.FILL, false, false); >+ addButtonData.widthHint = 80; >+ addButton.setLayoutData(addButtonData); >+ addButton.addSelectionListener(new SelectionAdapter() { >+ /* (non-Javadoc) >+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) >+ */ >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ handleAddButtonSelected(); >+ } >+ }); >+ >+ removeButton = new Button(buttonComp, SWT.NONE); >+ removeButton.setText("Remove"); //$NON-NLS-1$ >+ GridData removeButtonData = new GridData(SWT.FILL, SWT.FILL, false, false); >+ removeButtonData.widthHint = 80; >+ removeButton.setLayoutData(removeButtonData); >+ removeButton.addSelectionListener(new SelectionAdapter() { >+ /* (non-Javadoc) >+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) >+ */ >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ handleRemoveButtonSelected(); >+ } >+ }); >+ >+ } >+ >+ public void addModifyListener(ModifyListener listener) { >+ modifyListeners.add(listener); >+ } >+ >+ public void removeModifyListener(ModifyListener listener) { >+ modifyListeners.remove(listener); >+ } >+ >+ public String getEnvironment() { >+ String env = ""; //$NON-NLS-1$ >+ >+ for (int i = 0; i < table.getItemCount(); i++) { >+ if (i > 0) { >+ env += "\n"; //$NON-NLS-1$ >+ } >+ TableItem item = table.getItem(i); >+ env += item.getText(0) + "=" + item.getText(1); //$NON-NLS-1$ >+ } >+ >+ return env; >+ } >+ >+ public void setEnvironment(String env) { >+ table.clearAll(); >+ if (env != null) { >+ for (String envs : env.split("\n")) { //$NON-NLS-1$ >+ String[] envVar = envs.split("="); //$NON-NLS-1$ >+ if (envVar.length == 2) { >+ TableItem item = new TableItem(table, SWT.NONE); >+ item.setText(0, envVar[0]); >+ item.setText(1, envVar[1]); >+ } >+ } >+ } >+ } >+ >+ protected void handleAddButtonSelected() { >+ EnvInputDialog dialog = new EnvInputDialog(getShell()); >+ if (dialog.open() != Window.OK) { >+ return; >+ } >+ >+ String var = dialog.getVariable(); >+ String value = dialog.getValue(); >+ >+ if (var != null && value != null && var.length() > 0 && value.length() >0) { >+ TableItem item = new TableItem(table, SWT.NONE); >+ item.setText(0, var.trim()); >+ item.setText(1, value.trim()); >+ } >+ >+ Event e = new Event(); >+ e.data = FieldModifier.VALUE_DSTORE_ENV; >+ notifyListeners(new ModifyEvent(e)); >+ } >+ >+ protected void handleRemoveButtonSelected() { >+ int index = table.getSelectionIndex(); >+ if (index >= 0) { >+ table.remove(index); >+ } >+ } >+ >+ private void notifyListeners(ModifyEvent e) { >+ for (Object listener : modifyListeners.getListeners()) { >+ ((ModifyListener)listener).modifyText(e); >+ } >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/wizards/DStoreServerWidget.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/DStoreServerWidget.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/DStoreServerWidget.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/DStoreServerWidget.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,131 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.wizards; >+ >+import org.eclipse.core.runtime.ListenerList; >+import org.eclipse.ptp.remote.core.IRemoteConnection; >+import org.eclipse.ptp.remote.core.IRemoteServices; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.TabFolder; >+import org.eclipse.swt.widgets.TabItem; >+ >+public class DStoreServerWidget extends Composite { >+ public enum FieldModifier { >+ VALUE_DSTORE_LOCATION, >+ VALUE_DSTORE_COMMAND, >+ VALUE_DSTORE_ENV, >+ VALUE_INDEX_LOCATION >+ } >+ >+ private ListenerList modifyListeners = new ListenerList(); >+ >+ private DStoreServerPage fServerPage; >+ private DStoreEnvironmentPage fEnvironmentPage; >+ private DStoreIndexPage fIndexPage; >+ >+ public DStoreServerWidget(Composite parent, int style) { >+ super(parent, style); >+ >+ setFont(parent.getFont()); >+ GridLayout layout = new GridLayout(1, false); >+ layout.marginHeight = 0; >+ layout.marginWidth = 0; >+ setLayout(layout); >+ setLayoutData(new GridData(GridData.FILL_BOTH)); >+ >+ TabFolder folder= new TabFolder(this, SWT.NONE); >+ folder.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ folder.setFont(this.getFont()); >+ >+ fServerPage = new DStoreServerPage(folder, SWT.NONE); >+ fServerPage.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ notifyListeners(e); >+ } >+ }); >+ TabItem item = new TabItem(folder, SWT.NONE); >+ item.setText("Server"); //$NON-NLS-1$ >+ item.setControl(fServerPage); >+ >+ fEnvironmentPage = new DStoreEnvironmentPage(folder, SWT.NONE); >+ fEnvironmentPage.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ notifyListeners(e); >+ } >+ }); >+ item = new TabItem(folder, SWT.NONE); >+ item.setText("Environment"); //$NON-NLS-1$ >+ item.setControl(fEnvironmentPage); >+ >+ fIndexPage = new DStoreIndexPage(folder, SWT.NONE); >+ fIndexPage.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ notifyListeners(e); >+ } >+ }); >+ item = new TabItem(folder, SWT.NONE); >+ item.setText("Index"); //$NON-NLS-1$ >+ item.setControl(fIndexPage); >+ } >+ >+ public void addModifyListener(ModifyListener listener) { >+ modifyListeners.add(listener); >+ } >+ >+ public String getDStoreCommand() { >+ return fServerPage.getServerCommand(); >+ } >+ >+ public String getDStoreEnvironment() { >+ return fEnvironmentPage.getEnvironment(); >+ } >+ >+ public String getDStoreLocation() { >+ return fServerPage.getLocationPath(); >+ } >+ >+ public String getIndexLocation() { >+ return fIndexPage.getLocationPath(); >+ } >+ >+ public void removeModifyListener(ModifyListener listener) { >+ modifyListeners.remove(listener); >+ } >+ >+ public void setConnection(IRemoteServices services, IRemoteConnection conn) { >+ fServerPage.setConnection(services, conn); >+ fIndexPage.setConnection(services, conn); >+ } >+ >+ public void setDStoreCommand(String command) { >+ fServerPage.setServerCommand(command); >+ } >+ >+ public void setDStoreEnvironment(String env) { >+ fEnvironmentPage.setEnvironment(env); >+ } >+ >+ public void setDStoreLocation(String path) { >+ fServerPage.setLocationPath(path); >+ } >+ >+ public void setIndexLocation(String path) { >+ fIndexPage.setLocationPath(path); >+ } >+ >+ private void notifyListeners(ModifyEvent e) { >+ for (Object listener : modifyListeners.getListeners()) { >+ ((ModifyListener)listener).modifyText(e); >+ } >+ } >+} >Index: data/dstore-server.properties >=================================================================== >RCS file: data/dstore-server.properties >diff -N data/dstore-server.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ data/dstore-server.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2 @@ >+COMMAND=java -Xms64m -Xmx128m -Xss2m -DA_PLUGIN_PATH=. -DDSTORE_TRACING_ON=false -Dclient.username=$USER -DDSTORE_SPIRIT_ON=true org.eclipse.dstore.core.server.Server 0 60000 >+CLASSPATH=.:dstore_extra_server.jar:dstore_core.jar:dstore_miners.jar:clientserver.jar:cdtminer.jar:cdtmodel.jar:cdtparser.jar:org.eclipse.core.runtime_3.5.0.v20090525.jar:org.eclipse.equinox.common_3.5.0.v20090520-1800.jar:org.eclipse.core.filesystem_1.2.0.v20090507.jar:com.ibm.icu.base_4.0.1.v20090415.jar:stubs.jar:lrparser.jar:xlcparser.jar:net.sourceforge.lpg.lpgjavaruntime_1.1.0.v200803061910.jar >Index: src/org/eclipse/ptp/rdt/ui/serviceproviders/RemoteCIndexServiceProvider2.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/serviceproviders/RemoteCIndexServiceProvider2.java >diff -N src/org/eclipse/ptp/rdt/ui/serviceproviders/RemoteCIndexServiceProvider2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/serviceproviders/RemoteCIndexServiceProvider2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,324 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 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 - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.serviceproviders; >+ >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Path; >+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.model.IModelBuilderService; >+import org.eclipse.ptp.internal.rdt.core.model.RemoteModelBuilderService; >+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.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.core.messages.Messages; >+import org.eclipse.ptp.rdt.ui.subsystems.RemoteCIndexSubsystem2; >+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.ServiceProvider; >+ >+public class RemoteCIndexServiceProvider2 extends ServiceProvider implements IIndexServiceProvider2 { >+ >+ protected boolean fIsConfigured; >+ >+ protected IIndexLifecycleService fIndexLifecycleService; >+ protected INavigationService fNavigationService; >+ protected ICallHierarchyService fCallHierarchyService; >+ protected ITypeHierarchyService fTypeHierarchyService; >+ protected IIncludeBrowserService fIncludeBrowserService; >+ protected IModelBuilderService fModelBuilderService; >+ protected RemoteSearchService fSearchService; >+ protected IContentAssistService fContentAssistService; >+ protected RemoteCIndexSubsystem2 fSubsystem = null; >+ protected String indexLocation; >+ >+ public static final String ID = "org.eclipse.ptp.rdt.ui.RemoteCIndexServiceProvider2"; //$NON-NLS-1$ >+ public static final String NAME = Messages.RemoteCIndexServiceProvider_0; >+ public static final String SERVICE_ID = "org.eclipse.ptp.rdt.core.CIndexingService"; //$NON-NLS-1$ >+ >+ private static final String SERVICE_ID_KEY = "service-name"; //$NON-NLS-1$ >+ private static final String CONNECTION_NAME_KEY = "connection-name"; //$NON-NLS-1$ >+ private static final String INDEX_LOCATION_KEY = "index-location"; //$NON-NLS-1$ >+ private static final String DSTORE_LOCATION_KEY = "dstore-location"; //$NON-NLS-1$ >+ private static final String DSTORE_COMMAND_KEY = "dstore-command"; //$NON-NLS-1$ >+ private static final String DSTORE_ENV_KEY = "dstore-env"; //$NON-NLS-1$ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider#getCallHierarchyService() >+ */ >+ public synchronized ICallHierarchyService getCallHierarchyService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fCallHierarchyService== null) >+ fCallHierarchyService = new RemoteCallHierarchyService(fSubsystem); >+ >+ return fCallHierarchyService; >+ } >+ >+ /** >+ * Get the host name for this connection. >+ * >+ * @return host name >+ */ >+ public String getConnectionName() { >+ return getString(CONNECTION_NAME_KEY, null); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.ui.serviceproviders.IIndexServiceProvider2#getContentAssistService() >+ */ >+ public IContentAssistService getContentAssistService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fContentAssistService == null) >+ fContentAssistService = new RemoteContentAssistService(fSubsystem); >+ >+ return fContentAssistService; >+ } >+ >+ public String getDStoreEnv() { >+ initialize(); >+ return getString(DSTORE_ENV_KEY, ""); //$NON-NLS-1$ >+ } >+ >+ public String getDStoreCommand() { >+ initialize(); >+ return getString(DSTORE_COMMAND_KEY, ""); //$NON-NLS-1$ >+ } >+ >+ public String getDStoreLocation() { >+ initialize(); >+ return getString(DSTORE_LOCATION_KEY, ""); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider#getIncludeBrowserService() >+ */ >+ public synchronized IIncludeBrowserService getIncludeBrowserService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fIncludeBrowserService== null) >+ fIncludeBrowserService = new RemoteIncludeBrowserService(fSubsystem); >+ >+ return fIncludeBrowserService; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider#getIndexLifeCycleService() >+ */ >+ public synchronized IIndexLifecycleService getIndexLifeCycleService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fIndexLifecycleService == null) >+ fIndexLifecycleService = new RemoteIndexLifecycleService(fSubsystem); >+ >+ return fIndexLifecycleService; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider#getIndexLocation() >+ */ >+ public String getIndexLocation() { >+ initialize(); >+ return getString(INDEX_LOCATION_KEY, ""); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider#getModelBuilderService() >+ */ >+ public synchronized IModelBuilderService getModelBuilderService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fModelBuilderService== null) >+ fModelBuilderService = new RemoteModelBuilderService(fSubsystem); >+ >+ return fModelBuilderService; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider#getNavigationService() >+ */ >+ public synchronized INavigationService getNavigationService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fNavigationService== null) >+ fNavigationService = new RemoteNavigationService(fSubsystem); >+ >+ return fNavigationService; >+ } >+ >+ public IRemoteConnection getRemoteConnection() { >+ if (!isConfigured()) { >+ return null; >+ } >+ return getRemoteServices().getConnectionManager().getConnection(getConnectionName()); >+ } >+ >+ public IRemoteServices getRemoteServices() { >+ if (!isConfigured()) { >+ return null; >+ } >+ return PTPRemoteCorePlugin.getDefault().getRemoteServices(getServiceId()); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.ui.serviceproviders.IIndexServiceProvider2#getSearchService() >+ */ >+ public ISearchService getSearchService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fSearchService == null) >+ fSearchService = new RemoteSearchService(fSubsystem); >+ >+ return fSearchService; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.core.ServiceProvider#getServiceId() >+ */ >+ @Override >+ public String getServiceId() { >+ return getString(SERVICE_ID_KEY, null); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider#getTypeHierarchyService() >+ */ >+ public synchronized ITypeHierarchyService getTypeHierarchyService() { >+ if(!isConfigured()) >+ return null; >+ >+ if(fTypeHierarchyService== null) >+ fTypeHierarchyService = new RemoteTypeHierarchyService(fSubsystem); >+ >+ return fTypeHierarchyService; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.core.IServiceProvider#isConfigured() >+ */ >+ public boolean isConfigured() { >+ initialize(); >+ return fIsConfigured; >+ } >+ >+ /** >+ * @param isConfigured >+ */ >+ public void setConfigured(boolean isConfigured) { >+ fIsConfigured = isConfigured; >+ } >+ >+ /** >+ * Set a new connection for this service provider. This will reset the index >+ * and DStore server locations to their default values. >+ * >+ * @param services new remote service provider >+ * @param connection new connection >+ */ >+ public void setConnection(IRemoteServices services, IRemoteConnection connection) { >+ setConnection(services, connection, true); >+ } >+ >+ /** >+ * Set the host name for this connection >+ * >+ * @param hostName >+ */ >+ public void setConnectionName(String connectionName) { >+ putString(CONNECTION_NAME_KEY, connectionName); >+ } >+ >+ public void setDStoreEnv(String env) { >+ putString(DSTORE_ENV_KEY, env); >+ } >+ >+ public void setDStoreCommand(String command) { >+ putString(DSTORE_COMMAND_KEY, command); >+ } >+ >+ public void setDStoreLocation(String path) { >+ putString(DSTORE_LOCATION_KEY, path); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.rdt.core.serviceproviders.IIndexServiceProvider#setIndexLocation(java.lang.String) >+ */ >+ public void setIndexLocation(String path) { >+ putString(INDEX_LOCATION_KEY, path); >+ } >+ >+ /** >+ * @param serviceId >+ */ >+ public void setServiceId(String serviceId) { >+ putString(SERVICE_ID_KEY, serviceId); >+ } >+ >+ /* (non-Javadoc) >+ * @see java.lang.Object#toString() >+ */ >+ @Override >+ public String toString() { >+ return "RemoteCIndexServiceProvider2(" + getIndexLocation() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ private void initialize() { >+ if (fSubsystem == null && getServiceId() != null) { >+ IRemoteServices services = PTPRemoteCorePlugin.getDefault().getRemoteServices(getServiceId()); >+ if (services != null && getConnectionName() != null) { >+ IRemoteConnection connection = services.getConnectionManager().getConnection(getConnectionName()); >+ setConnection(services, connection, false); >+ } >+ } >+ } >+ >+ /** >+ * Set a new connection for this service provider. If reset is true the index >+ * and DStore server locations will be reset to their default values. >+ * >+ * @param services new remote service provider >+ * @param connection new connection >+ * @param reset reset locations to defaults >+ */ >+ private void setConnection(IRemoteServices services, IRemoteConnection connection, boolean reset) { >+ setServiceId(services.getId()); >+ setConnectionName(connection.getName()); >+ if (reset) { >+ IPath workingDir = new Path(services.getFileManager(connection).getWorkingDirectory()); >+ setIndexLocation(workingDir.append(".eclipsesettings").toString()); //$NON-NLS-1$ >+ setDStoreLocation(workingDir.toString()); >+ } >+ if (fSubsystem != null) { >+ fSubsystem.dispose(); >+ } >+ fSubsystem = new RemoteCIndexSubsystem2(this); >+ setConfigured(true); >+ } >+ >+} >Index: src/org/eclipse/ptp/rdt/ui/wizards/RemoteCIndexServiceProvider2Contributer.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/RemoteCIndexServiceProvider2Contributer.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/RemoteCIndexServiceProvider2Contributer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/RemoteCIndexServiceProvider2Contributer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,255 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ *******************************************************************************/ >+package org.eclipse.ptp.rdt.ui.wizards; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+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.RemoteCIndexServiceProvider2; >+import org.eclipse.ptp.rdt.ui.wizards.DStoreServerWidget.FieldModifier; >+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.core.IServiceProvider; >+import org.eclipse.ptp.services.ui.IServiceProviderContributor; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+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.Group; >+import org.eclipse.swt.widgets.Label; >+ >+ >+public class RemoteCIndexServiceProvider2Contributer implements IServiceProviderContributor { >+ >+ private RemoteCIndexServiceProvider2 fProvider; >+ >+ private Map<Integer, IRemoteServices> fComboIndexToRemoteServicesProviderMap = new HashMap<Integer, IRemoteServices>(); >+ private IRemoteServices fSelectedServices; >+ private Map<Integer, IRemoteConnection> fComboIndexToRemoteConnectionMap = new HashMap<Integer, IRemoteConnection>(); >+ private IRemoteConnection fSelectedConnection; >+ private DStoreServerWidget fServerWidget; >+ private String fDStorePath; >+ private String fDStoreCommand; >+ private String fDStoreEnv; >+ private String fConfigPath; >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.IServiceProviderContributor#configureServiceProvider(org.eclipse.ptp.services.core.IServiceProvider, org.eclipse.swt.widgets.Composite) >+ */ >+ public void configureServiceProvider(IServiceProvider sp, final Composite container) { >+ if(!(sp instanceof RemoteCIndexServiceProvider2)) >+ throw new IllegalArgumentException(); // should never happen >+ >+ fProvider = (RemoteCIndexServiceProvider2) sp; >+ >+ container.setLayout(new GridLayout(1, false)); >+ >+ Group connectionGroup = new Group(container, SWT.NONE); >+ connectionGroup.setText("Connection"); //$NON-NLS-1$ >+ connectionGroup.setLayout(new GridLayout(3, false)); >+ connectionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ >+ // Label for "Provider:" >+ Label providerLabel = new Label(connectionGroup, SWT.LEFT); >+ providerLabel.setText("Provider:"); //$NON-NLS-1$ >+ >+ // combo for providers >+ final Combo providerCombo = new Combo(connectionGroup, 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); >+ >+ populateProviderCombo(providerCombo); >+ >+ // connection combo >+ // Label for "Connection:" >+ Label connectionLabel = new Label(connectionGroup, SWT.LEFT); >+ connectionLabel.setText("Connection:"); //$NON-NLS-1$ >+ >+ // combo for providers >+ final Combo connectionCombo = new Combo(connectionGroup, 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(connectionGroup, SWT.PUSH); >+ newConnectionButton.setText("New..."); //$NON-NLS-1$ >+ updateNewConnectionButtonEnabled(newConnectionButton); >+ >+ newConnectionButton.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ IRemoteUIConnectionManager connectionManager = getUIConnectionManager(); >+ if(connectionManager != null) { >+ connectionManager.newConnection(container.getShell()); >+ } >+ // refresh list of connections >+ populateConnectionCombo(connectionCombo); >+ } >+ }); >+ >+ providerCombo.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ int selectionIndex = providerCombo.getSelectionIndex(); >+ fSelectedServices = fComboIndexToRemoteServicesProviderMap.get(selectionIndex); >+ populateConnectionCombo(connectionCombo); >+ updateNewConnectionButtonEnabled(newConnectionButton); >+ fServerWidget.setConnection(fSelectedServices, fSelectedConnection); >+ } >+ }); >+ >+ connectionCombo.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ int selectionIndex = connectionCombo.getSelectionIndex(); >+ fSelectedConnection = fComboIndexToRemoteConnectionMap.get(selectionIndex); >+ updateNewConnectionButtonEnabled(newConnectionButton); >+ fProvider.setConnection(fSelectedServices, fSelectedConnection); >+ fServerWidget.setConnection(fSelectedServices, fSelectedConnection); >+ } >+ }); >+ >+ fServerWidget = new DStoreServerWidget(container, SWT.NONE); >+ data = new GridData(SWT.FILL, SWT.FILL, true, false); >+ data.horizontalSpan = 3; >+ fServerWidget.setLayoutData(data); // set layout to grab horizontal space >+ >+ /* >+ * Set connection information before updating widget with >+ * saved data. >+ */ >+ fServerWidget.setConnection(fSelectedServices, fSelectedConnection); >+ >+ fServerWidget.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ if (e.data == FieldModifier.VALUE_DSTORE_LOCATION) { >+ fDStorePath = fServerWidget.getDStoreLocation(); >+ fProvider.setDStoreLocation(fDStorePath); >+ } >+ if (e.data == FieldModifier.VALUE_DSTORE_COMMAND) { >+ fDStoreCommand = fServerWidget.getDStoreCommand(); >+ fProvider.setDStoreCommand(fDStoreCommand); >+ } >+ if (e.data == FieldModifier.VALUE_DSTORE_ENV) { >+ fDStoreEnv = fServerWidget.getDStoreEnvironment(); >+ fProvider.setDStoreEnv(fDStoreEnv); >+ } >+ if (e.data == FieldModifier.VALUE_INDEX_LOCATION) { >+ fConfigPath = fServerWidget.getIndexLocation(); >+ fProvider.setIndexLocation(fConfigPath); >+ } >+ } >+ }); >+ >+ /* >+ * Initialize widget with default values. This will trigger >+ * ModifyEvents on the widget to update the field variables. >+ */ >+ fServerWidget.setDStoreCommand(fProvider.getDStoreCommand()); >+ fServerWidget.setDStoreEnvironment(fProvider.getDStoreEnv()); >+ fServerWidget.setDStoreLocation(fProvider.getDStoreLocation()); >+ fServerWidget.setIndexLocation(fProvider.getIndexLocation()); >+ } >+ >+ /* (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) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ptp.services.ui.IServiceProviderContributor#getWizardPages(org.eclipse.jface.wizard.IWizard, org.eclipse.ptp.services.core.IServiceProvider) >+ */ >+ public WizardPage[] getWizardPages(IWizard wizard, IServiceProvider provider) { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+ private IRemoteUIConnectionManager getUIConnectionManager() { >+ IRemoteUIConnectionManager connectionManager = >+ PTPRemoteUIPlugin.getDefault().getRemoteUIServices(fSelectedServices).getUIConnectionManager(); >+ return connectionManager; >+ } >+ >+ private void populateConnectionCombo(final Combo connectionCombo) { >+ connectionCombo.removeAll(); >+ >+ //attempt to restore settings from saved state >+ IRemoteConnection connectionSelected = null; >+ if (fProvider.getServiceId() != null) { >+ IRemoteServices providerSelected = PTPRemoteCorePlugin.getDefault().getRemoteServices(fProvider.getServiceId()); >+ if (providerSelected != null && fProvider.getConnectionName() != null) { >+ connectionSelected = providerSelected.getConnectionManager().getConnection(fProvider.getConnectionName()); >+ } >+ } >+ >+ IRemoteConnection[] connections = fSelectedServices.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().equals(connections[k].getName())) { >+ 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 populateProviderCombo(final Combo providerCombo) { >+ //attempt to restore settings from saved state >+ IRemoteServices providerSelected = null; >+ if (fProvider.getServiceId() != null) { >+ providerSelected = PTPRemoteCorePlugin.getDefault().getRemoteServices(fProvider.getServiceId()); >+ } >+ >+ // 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.getId().compareTo(providers[k].getId()) == 0) { >+ toSelect = k; >+ } >+ } >+ >+ // set selected host to be the first one if we're not restoring from settings >+ providerCombo.select(toSelect); >+ fSelectedServices = fComboIndexToRemoteServicesProviderMap.get(toSelect); >+ } >+ >+ private void updateNewConnectionButtonEnabled(Button button) { >+ IRemoteUIConnectionManager connectionManager = getUIConnectionManager(); >+ button.setEnabled(connectionManager != null); >+ } >+} >Index: src/org/eclipse/ptp/rdt/ui/wizards/RemoteProjectContentsLocationArea.java >=================================================================== >RCS file: src/org/eclipse/ptp/rdt/ui/wizards/RemoteProjectContentsLocationArea.java >diff -N src/org/eclipse/ptp/rdt/ui/wizards/RemoteProjectContentsLocationArea.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ptp/rdt/ui/wizards/RemoteProjectContentsLocationArea.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,490 @@ >+/******************************************************************************* >+ * 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.wizards; >+ >+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.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.UIPlugin; >+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.IRemoteUIConstants; >+import org.eclipse.ptp.remote.ui.IRemoteUIFileManager; >+import org.eclipse.ptp.remote.ui.IRemoteUIServices; >+import org.eclipse.ptp.remote.ui.PTPRemoteUIPlugin; >+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, UIPlugin.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, UIPlugin.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(); >+ String selectedPath = fileMgr.browseDirectory(fLocationText.getShell(), "Project Location (" + fSelectedConnection.getName() + ")", correctPath, IRemoteUIConstants.NONE); //$NON-NLS-1$ //$NON-NLS-2$ >+ if (selectedPath != null) { >+ fLocationText.setText(selectedPath); >+ } >+ } >+ } >+ } >+ } >+ } >+ }); >+ >+ return container; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.Dialog#okPressed() >+ */ >+ protected void okPressed() { >+ >+ // set the provider >+ fProvider.setRemoteToolsProviderID(fSelectedProvider.getId()); >+ fProvider.setRemoteToolsConnection(fSelectedConnection); >+ >+ } >+ >+ public IRemoteServices getRemoteServices() { >+ return fSelectedProvider; >+ } >+ >+ public IRemoteConnection getRemoteConnection() { >+ return fSelectedConnection; >+ } >+ >+ /** >+ * Return the location for the project. >+ * >+ * @return String >+ */ >+ public String getProjectLocation() { >+ return fLocationText.getText(); >+ } >+ >+ /** >+ * Returns the name of the selected connection. >+ */ >+ public IRemoteConnection getConnection() { >+ return fSelectedConnection; >+ } >+}
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 293929
: 151073 |
151089