Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 313392 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.properties (-2 / +3 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2000, 2010 IBM Corporation and others.
2
# Copyright (c) 2000, 2011 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
Lines 260-263 Link Here
260
structureMergeViewers.manifest.label=Manifest Structure Compare
260
structureMergeViewers.manifest.label=Manifest Structure Compare
261
structureMergeViewers.plugin.label=Plug-in Structure Compare
261
structureMergeViewers.plugin.label=Plug-in Structure Compare
262
commandParameter.name = The initial search pattern for the artifact search dialog
262
commandParameter.name = The initial search pattern for the artifact search dialog
263
consoleFactory.label = Host OSGi Console
263
consoleFactory.label = Host OSGi Console
264
importFromRepository.label = Import from repository...
(-)plugin.xml (+12 lines)
Lines 925-930 Link Here
925
               id="org.eclipse.pde.ui.OpenManifestAction"> 
925
               id="org.eclipse.pde.ui.OpenManifestAction"> 
926
         </action> 
926
         </action> 
927
      </objectContribution>
927
      </objectContribution>
928
      <objectContribution
929
            adaptable="false"
930
            id="org.eclipse.pde.ui.referencedLibsToolSet"
931
            objectClass="org.eclipse.jdt.core.IPackageFragmentRoot">
932
         <action
933
               class="org.eclipse.pde.internal.ui.views.plugins.ImportFromRepositoryActionDelegate"
934
               icon="icons/etool16/imp_extplug.gif"
935
               id="org.eclipse.pde.ui.importFromRepo"
936
               label="%importFromRepository.label"
937
               menubarPath="group.import">
938
         </action>
939
      </objectContribution>
928
   </extension>
940
   </extension>
929
   <extension
941
   <extension
930
         point="org.eclipse.debug.ui.launchConfigurationTypeImages">
942
         point="org.eclipse.debug.ui.launchConfigurationTypeImages">
(-)src/org/eclipse/pde/internal/ui/pderesources.properties (-1 / +1 lines)
Lines 1067-1073 Link Here
1067
TemplateSelectionPage_column_point = Extension Point
1067
TemplateSelectionPage_column_point = Extension Point
1068
1068
1069
ImportActionGroup_binaryWithLinkedContent=Binary Project with &Linked Content
1069
ImportActionGroup_binaryWithLinkedContent=Binary Project with &Linked Content
1070
ImportActionGroup_cannot_import=The selected plug-ins cannot be imported from a repository.
1070
ImportActionGroup_cannot_import=The selected plug-ins cannot be imported from a repository. The plug-ins do not have an Eclipse-SourceReferences manifest header that can be processed. 
1071
ImportActionGroup_importContributingPlugin=&Import Contributing Plug-in as
1071
ImportActionGroup_importContributingPlugin=&Import Contributing Plug-in as
1072
ImportActionGroup_Repository_project=P&roject from a Repository...
1072
ImportActionGroup_Repository_project=P&roject from a Repository...
1073
1073
(-)src/org/eclipse/pde/internal/ui/views/plugins/ImportActionGroup.java (-2 / +16 lines)
Lines 12-17 Link Here
12
12
13
import java.util.*;
13
import java.util.*;
14
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.jdt.core.IPackageFragmentRoot;
15
import org.eclipse.jface.action.*;
16
import org.eclipse.jface.action.*;
16
import org.eclipse.jface.dialogs.MessageDialog;
17
import org.eclipse.jface.dialogs.MessageDialog;
17
import org.eclipse.jface.viewers.ISelection;
18
import org.eclipse.jface.viewers.ISelection;
Lines 81-87 Link Here
81
		}
82
		}
82
	}
83
	}
83
84
84
	private void handleImport(int importType, IStructuredSelection selection) {
85
	static void handleImport(int importType, IStructuredSelection selection) {
85
		ArrayList externalModels = new ArrayList();
86
		ArrayList externalModels = new ArrayList();
86
		for (Iterator iter = selection.iterator(); iter.hasNext();) {
87
		for (Iterator iter = selection.iterator(); iter.hasNext();) {
87
			IPluginModelBase model = getModel(iter.next());
88
			IPluginModelBase model = getModel(iter.next());
Lines 111-117 Link Here
111
	 * @param models candidate models
112
	 * @param models candidate models
112
	 * @return  map of importer to import descriptions
113
	 * @return  map of importer to import descriptions
113
	 */
114
	 */
114
	private Map getImportDescriptions(Shell shell, IPluginModelBase[] models) {
115
	private static Map getImportDescriptions(Shell shell, IPluginModelBase[] models) {
115
		BundleProjectService service = (BundleProjectService) BundleProjectService.getDefault();
116
		BundleProjectService service = (BundleProjectService) BundleProjectService.getDefault();
116
		try {
117
		try {
117
			Map descriptions = service.getImportDescriptions(models); // all possible descriptions
118
			Map descriptions = service.getImportDescriptions(models); // all possible descriptions
Lines 149-158 Link Here
149
		} else if (next instanceof BundleDescription) {
150
		} else if (next instanceof BundleDescription) {
150
			model = PDECore.getDefault().getModelManager().findModel((BundleDescription) next);
151
			model = PDECore.getDefault().getModelManager().findModel((BundleDescription) next);
151
		} else if (next instanceof BundleSpecification) {
152
		} else if (next instanceof BundleSpecification) {
153
			// Required for contents of Target Platform State View
152
			BundleDescription desc = (BundleDescription) ((BundleSpecification) next).getSupplier();
154
			BundleDescription desc = (BundleDescription) ((BundleSpecification) next).getSupplier();
153
			if (desc != null) {
155
			if (desc != null) {
154
				model = PDECore.getDefault().getModelManager().findModel(desc);
156
				model = PDECore.getDefault().getModelManager().findModel(desc);
155
			}
157
			}
158
		} else if (next instanceof IPackageFragmentRoot) {
159
			// Required for context menu on PDE classpath container entries
160
			IPackageFragmentRoot root = (IPackageFragmentRoot) next;
161
			if (root.isExternal()) {
162
				String path = root.getPath().toOSString();
163
				IPluginModelBase[] externalModels = PDECore.getDefault().getModelManager().getExternalModels();
164
				for (int i = 0; i < externalModels.length; i++) {
165
					if (path.equals(externalModels[i].getInstallLocation())) {
166
						return externalModels[i];
167
					}
168
				}
169
			}
156
		}
170
		}
157
		return model;
171
		return model;
158
172
(-)src/org/eclipse/pde/internal/ui/views/plugins/ImportFromRepositoryActionDelegate.java (+60 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.views.plugins;
12
13
import org.eclipse.jface.action.IAction;
14
import org.eclipse.jface.viewers.ISelection;
15
import org.eclipse.jface.viewers.IStructuredSelection;
16
import org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation;
17
import org.eclipse.ui.IObjectActionDelegate;
18
import org.eclipse.ui.IWorkbenchPart;
19
20
/**
21
 * Action delegate to import a selected object if it represents a plug-in with a
22
 * Eclipse-SourceReferences header that can be processed by Team.
23
 * 
24
 * @see ImportActionGroup
25
 */
26
public class ImportFromRepositoryActionDelegate implements IObjectActionDelegate {
27
28
	/**
29
	 * Stores the last selection to pass to import operation
30
	 */
31
	private ISelection fSelection;
32
33
	/* (non-Javadoc)
34
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
35
	 */
36
	public void run(IAction action) {
37
		if (fSelection instanceof IStructuredSelection) {
38
			ImportActionGroup.handleImport(PluginImportOperation.IMPORT_FROM_REPOSITORY, (IStructuredSelection) fSelection);
39
		}
40
	}
41
42
	/* (non-Javadoc)
43
	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
44
	 */
45
	public void selectionChanged(IAction action, ISelection selection) {
46
		fSelection = selection;
47
		boolean enable = false;
48
		if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
49
			enable = ImportActionGroup.canImport((IStructuredSelection) selection);
50
		}
51
		action.setEnabled(enable);
52
	}
53
54
	/* (non-Javadoc)
55
	 * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
56
	 */
57
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
58
	}
59
60
}

Return to bug 313392