|
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 |
|