author | dadubrow |
Mon, 14 Jun 2010 12:55:27 -0500 | |
changeset 1470 | f3c18a46b6c5 |
parent 1452 | 52ab0fedbbff |
child 1472 | 6eab8978b7d5 |
permissions | -rw-r--r-- |
1360 | 1 |
package com.nokia.carbide.discovery.ui.view; |
2 |
||
3 |
||
1363 | 4 |
import java.io.File; |
5 |
import java.io.FileInputStream; |
|
6 |
import java.io.IOException; |
|
7 |
import java.io.InputStream; |
|
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
8 |
import java.net.URI; |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
9 |
import java.net.URISyntaxException; |
1363 | 10 |
import java.net.URL; |
11 |
import java.text.MessageFormat; |
|
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
12 |
import java.util.Collection; |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
13 |
import java.util.HashSet; |
1360 | 14 |
import java.util.List; |
1363 | 15 |
import java.util.Properties; |
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
16 |
import java.util.Set; |
1360 | 17 |
|
1363 | 18 |
import org.eclipse.core.runtime.IPath; |
19 |
import org.eclipse.core.runtime.Path; |
|
20 |
import org.eclipse.core.runtime.Platform; |
|
1360 | 21 |
import org.eclipse.equinox.internal.p2.discovery.Catalog; |
22 |
import org.eclipse.equinox.internal.p2.discovery.DiscoveryCore; |
|
1366
c61bb9dcfe74
fix potential NPE + add bundle discovery for testing
dadubrow
parents:
1363
diff
changeset
|
23 |
import org.eclipse.equinox.internal.p2.discovery.compatibility.BundleDiscoveryStrategy; |
1360 | 24 |
import org.eclipse.equinox.internal.p2.discovery.compatibility.RemoteBundleDiscoveryStrategy; |
25 |
import org.eclipse.equinox.internal.p2.discovery.model.CatalogItem; |
|
26 |
import org.eclipse.equinox.internal.p2.ui.discovery.DiscoveryUi; |
|
27 |
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogConfiguration; |
|
28 |
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogViewer; |
|
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
29 |
import org.eclipse.equinox.p2.core.IProvisioningAgent; |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
30 |
import org.eclipse.equinox.p2.operations.ProvisioningSession; |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
31 |
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
32 |
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
33 |
import org.eclipse.equinox.p2.ui.ProvisioningUI; |
1360 | 34 |
import org.eclipse.jface.action.Action; |
35 |
import org.eclipse.jface.action.IMenuManager; |
|
36 |
import org.eclipse.jface.action.IToolBarManager; |
|
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
37 |
import org.eclipse.jface.action.Separator; |
1361 | 38 |
import org.eclipse.jface.dialogs.ProgressMonitorDialog; |
1360 | 39 |
import org.eclipse.jface.layout.GridDataFactory; |
40 |
import org.eclipse.jface.layout.GridLayoutFactory; |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
41 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
1360 | 42 |
import org.eclipse.jface.viewers.IStructuredSelection; |
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
43 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
1360 | 44 |
import org.eclipse.jface.viewers.StructuredSelection; |
1363 | 45 |
import org.eclipse.osgi.service.datalocation.Location; |
1360 | 46 |
import org.eclipse.swt.SWT; |
47 |
import org.eclipse.swt.widgets.Composite; |
|
48 |
import org.eclipse.swt.widgets.Display; |
|
49 |
import org.eclipse.ui.IActionBars; |
|
50 |
import org.eclipse.ui.PlatformUI; |
|
51 |
import org.eclipse.ui.actions.BaseSelectionListenerAction; |
|
52 |
import org.eclipse.ui.part.ViewPart; |
|
53 |
||
54 |
import com.nokia.carbide.discovery.ui.Activator; |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
55 |
import com.nokia.carbide.discovery.ui.Messages; |
1360 | 56 |
|
57 |
@SuppressWarnings("restriction") |
|
1361 | 58 |
public class DiscoveryView extends ViewPart { |
1363 | 59 |
|
60 |
private static final String DIRECTORY_KEY = "com.nokia.carbide.discovery.directory"; //$NON-NLS-1$ |
|
1360 | 61 |
|
62 |
private CatalogViewer viewer; |
|
63 |
private Action refreshAction; |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
64 |
private BaseSelectionListenerAction checkAllAction; |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
65 |
private BaseSelectionListenerAction checkNoneAction; |
1361 | 66 |
private BaseSelectionListenerAction installAction; |
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
67 |
private Action showInstallWizardAction; |
1360 | 68 |
|
1361 | 69 |
private boolean initialized; |
1360 | 70 |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
71 |
private ISelectionChangedListener selectionListener; |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
72 |
|
1360 | 73 |
public DiscoveryView() { |
74 |
} |
|
75 |
||
76 |
/** |
|
77 |
* This is a callback that will allow us |
|
78 |
* to create the viewer and initialize it. |
|
79 |
*/ |
|
80 |
public void createPartControl(Composite parent) { |
|
81 |
Composite c = new Composite(parent, SWT.NONE); |
|
82 |
GridLayoutFactory.fillDefaults().applyTo(c); |
|
83 |
viewer = new CatalogViewer(getCatalog(), getSite(), getSite().getWorkbenchWindow(), getConfiguration()); |
|
84 |
viewer.createControl(c); |
|
85 |
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl()); |
|
86 |
||
87 |
// Create the help context id for the viewer's control |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
88 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), |
1452 | 89 |
"com.nokia.carbide.discovery.ui.view.DiscoveryView.catalogviewer"); //$NON-NLS-1$ |
1360 | 90 |
makeActions(); |
91 |
contributeToActionBars(); |
|
92 |
} |
|
93 |
||
94 |
private CatalogConfiguration getConfiguration() { |
|
95 |
CatalogConfiguration configuration = new CatalogConfiguration(); |
|
96 |
configuration.setShowTagFilter(false); |
|
97 |
return configuration; |
|
98 |
} |
|
99 |
||
100 |
private Catalog getCatalog() { |
|
101 |
Catalog catalog = new Catalog(); |
|
102 |
catalog.setEnvironment(DiscoveryCore.createEnvironment()); |
|
103 |
catalog.setVerifyUpdateSiteAvailability(false); |
|
1366
c61bb9dcfe74
fix potential NPE + add bundle discovery for testing
dadubrow
parents:
1363
diff
changeset
|
104 |
|
1360 | 105 |
// look for remote descriptor |
106 |
RemoteBundleDiscoveryStrategy remoteDiscoveryStrategy = new RemoteBundleDiscoveryStrategy(); |
|
1363 | 107 |
String url = getFromServerProperties(DIRECTORY_KEY); |
1366
c61bb9dcfe74
fix potential NPE + add bundle discovery for testing
dadubrow
parents:
1363
diff
changeset
|
108 |
if (url != null) { |
c61bb9dcfe74
fix potential NPE + add bundle discovery for testing
dadubrow
parents:
1363
diff
changeset
|
109 |
remoteDiscoveryStrategy.setDirectoryUrl(url); |
c61bb9dcfe74
fix potential NPE + add bundle discovery for testing
dadubrow
parents:
1363
diff
changeset
|
110 |
catalog.getDiscoveryStrategies().add(remoteDiscoveryStrategy); |
c61bb9dcfe74
fix potential NPE + add bundle discovery for testing
dadubrow
parents:
1363
diff
changeset
|
111 |
} |
c61bb9dcfe74
fix potential NPE + add bundle discovery for testing
dadubrow
parents:
1363
diff
changeset
|
112 |
else // look for descriptors from installed bundles |
c61bb9dcfe74
fix potential NPE + add bundle discovery for testing
dadubrow
parents:
1363
diff
changeset
|
113 |
catalog.getDiscoveryStrategies().add(new BundleDiscoveryStrategy()); |
1360 | 114 |
|
115 |
return catalog; |
|
116 |
} |
|
117 |
||
1363 | 118 |
public static String getFromServerProperties(String key) { |
119 |
Location installLocation = Platform.getInstallLocation(); |
|
120 |
URL url = installLocation.getURL(); |
|
121 |
IPath path = new Path(url.getPath()); |
|
122 |
path = path.append("configuration/server.properties"); //$NON-NLS-1$ |
|
123 |
File file = path.toFile(); |
|
124 |
Properties properties = new Properties(); |
|
125 |
try { |
|
126 |
InputStream is = new FileInputStream(file); |
|
127 |
properties.load(is); |
|
128 |
is.close(); |
|
129 |
} catch (IOException e) { |
|
130 |
String message = |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
131 |
MessageFormat.format(Messages.DiscoveryView_MissingDirectoryURLError, key); |
1363 | 132 |
Activator.logError(message, e); |
133 |
} |
|
134 |
return (String) properties.get(key); |
|
135 |
} |
|
136 |
||
1360 | 137 |
private void contributeToActionBars() { |
138 |
IActionBars bars = getViewSite().getActionBars(); |
|
139 |
fillLocalPullDown(bars.getMenuManager()); |
|
140 |
fillLocalToolBar(bars.getToolBarManager()); |
|
141 |
} |
|
142 |
||
143 |
private void fillLocalPullDown(IMenuManager manager) { |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
144 |
manager.add(checkAllAction); |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
145 |
manager.add(checkNoneAction); |
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
146 |
manager.add(new Separator()); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
147 |
manager.add(showInstallWizardAction); |
1360 | 148 |
} |
149 |
||
150 |
private void fillLocalToolBar(IToolBarManager manager) { |
|
151 |
manager.add(refreshAction); |
|
1361 | 152 |
manager.add(installAction); |
1360 | 153 |
} |
154 |
||
155 |
private void makeActions() { |
|
156 |
refreshAction = new Action() { |
|
157 |
public void run() { |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
158 |
viewer.setSelection(StructuredSelection.EMPTY); |
1426
6a454f350c2a
fix refresh action so data is gotten prior to viewer refresh
dadubrow
parents:
1385
diff
changeset
|
159 |
viewer.updateCatalog(); |
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
160 |
viewer.refresh(); |
1360 | 161 |
} |
162 |
}; |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
163 |
refreshAction.setText(Messages.DiscoveryView_RefreshLabel); |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
164 |
refreshAction.setImageDescriptor(Activator.getImageDescriptor("icons/refresh.gif")); //$NON-NLS-1$ |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
165 |
checkAllAction = new BaseSelectionListenerAction(Messages.DiscoveryView_CheckAllLabel) { |
1360 | 166 |
public void run() { |
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
167 |
viewer.setSelection(StructuredSelection.EMPTY); |
1360 | 168 |
viewer.setSelection(getAllItemsSelection()); |
169 |
viewer.refresh(); |
|
170 |
} |
|
171 |
||
172 |
private IStructuredSelection getAllItemsSelection() { |
|
1361 | 173 |
List<CatalogItem> catalogItems = viewer.getCatalog().getItems(); |
174 |
return new StructuredSelection(catalogItems); |
|
1360 | 175 |
} |
176 |
||
177 |
protected boolean updateSelection(IStructuredSelection selection) { |
|
178 |
return !getAllItemsSelection().equals(selection); |
|
179 |
}; |
|
180 |
}; |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
181 |
checkNoneAction = new BaseSelectionListenerAction(Messages.DiscoveryView_UncheckAllLabel) { |
1360 | 182 |
public void run() { |
183 |
viewer.setSelection(StructuredSelection.EMPTY); |
|
184 |
viewer.refresh(); |
|
185 |
}; |
|
186 |
||
187 |
protected boolean updateSelection(IStructuredSelection selection) { |
|
188 |
return !selection.isEmpty(); |
|
189 |
}; |
|
190 |
}; |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
191 |
installAction = new BaseSelectionListenerAction(Messages.DiscoveryView_InstallLabel) { |
1361 | 192 |
public void run() { |
193 |
DiscoveryUi.install(viewer.getCheckedItems(), new ProgressMonitorDialog(DiscoveryView.this.getViewSite().getShell())); |
|
194 |
}; |
|
195 |
||
196 |
protected boolean updateSelection(IStructuredSelection selection) { |
|
197 |
return !selection.isEmpty(); |
|
198 |
}; |
|
199 |
}; |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
200 |
installAction.setImageDescriptor(Activator.getImageDescriptor("icons/icon-discovery.png")); //$NON-NLS-1$ |
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
201 |
showInstallWizardAction = new Action(Messages.DiscoveryView_AdvancedInstallLabel) { |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
202 |
public void run() { |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
203 |
showInstallWizard(); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
204 |
} |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
205 |
}; |
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
206 |
viewer.addSelectionChangedListener(checkAllAction); |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
207 |
viewer.addSelectionChangedListener(checkNoneAction); |
1361 | 208 |
viewer.addSelectionChangedListener(installAction); |
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
209 |
selectionListener = new ISelectionChangedListener() { |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
210 |
@Override |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
211 |
public void selectionChanged(SelectionChangedEvent event) { |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
212 |
IStructuredSelection selection = (IStructuredSelection) event.getSelection(); |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
213 |
IActionBars bars = getViewSite().getActionBars(); |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
214 |
bars.getStatusLineManager().setMessage( |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
215 |
selection.isEmpty() ? null : MessageFormat.format( |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
216 |
Messages.DiscoveryView_StatusLineFmt, selection.size())); |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
217 |
} |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
218 |
}; |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
219 |
viewer.addSelectionChangedListener(selectionListener); |
1360 | 220 |
} |
221 |
||
222 |
@Override |
|
223 |
public void dispose() { |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
224 |
viewer.removeSelectionChangedListener(checkAllAction); |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
225 |
viewer.removeSelectionChangedListener(checkNoneAction); |
1361 | 226 |
viewer.removeSelectionChangedListener(installAction); |
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
227 |
viewer.removeSelectionChangedListener(selectionListener); |
1361 | 228 |
|
1360 | 229 |
super.dispose(); |
230 |
} |
|
231 |
||
232 |
/** |
|
233 |
* Passing the focus request to the viewer's control. |
|
234 |
*/ |
|
235 |
public void setFocus() { |
|
1361 | 236 |
if (!initialized) { |
237 |
initialized = true; |
|
1360 | 238 |
Display.getDefault().asyncExec(new Runnable() { |
239 |
@Override |
|
240 |
public void run() { |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
241 |
if (viewer.getViewer().getContentProvider() != null) { |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
242 |
viewer.updateCatalog(); |
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
243 |
} |
1360 | 244 |
} |
245 |
}); |
|
246 |
} |
|
247 |
} |
|
1374
67b625db1866
fix bugs, externalize strings, change some labels, add status line
dadubrow
parents:
1366
diff
changeset
|
248 |
|
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
249 |
private void showInstallWizard() { |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
250 |
ProvisioningUI defaultUI = ProvisioningUI.getDefaultUI(); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
251 |
ProvisioningSession session = defaultUI.getSession(); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
252 |
IProvisioningAgent agent = session.getProvisioningAgent(); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
253 |
IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
254 |
IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
255 |
for (URI uri : getCatalogURIs()) { |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
256 |
metadataManager.addRepository(uri); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
257 |
artifactManager.addRepository(uri); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
258 |
} |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
259 |
defaultUI.openInstallWizard(null, null, null); |
1452 | 260 |
|
1470 | 261 |
// String profileId = defaultUI.getProfileId(); |
262 |
// IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); |
|
263 |
// IProfile profile = profileRegistry.getProfile(profileId); |
|
264 |
// IQueryResult<IInstallableUnit> queryResult = profile.query(QueryUtil.createIUGroupQuery(), null); |
|
265 |
// List<String> list = new ArrayList<String>(); |
|
266 |
// for (Iterator<IInstallableUnit> iter = queryResult.iterator(); iter.hasNext();) { |
|
267 |
// IInstallableUnit iu = iter.next(); |
|
268 |
// list.add(iu.getId() + "|" + iu.getVersion()); |
|
269 |
// } |
|
270 |
// Collections.sort(list); |
|
271 |
// for (String s : list) { |
|
272 |
// System.out.println(s); |
|
273 |
// } |
|
1385
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
274 |
} |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
275 |
|
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
276 |
private Collection<URI> getCatalogURIs() { |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
277 |
Set<URI> uris = new HashSet<URI>(); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
278 |
for (CatalogItem catalogItem : viewer.getCatalog().getItems()) { |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
279 |
try { |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
280 |
uris.add(new URI(catalogItem.getSiteUrl())); |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
281 |
} catch (URISyntaxException e) { |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
282 |
// ignore bad URIs |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
283 |
} |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
284 |
} |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
285 |
return uris; |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
286 |
}; |
e626d1981906
Add advanced install menu action to discovery view
dadubrow
parents:
1374
diff
changeset
|
287 |
|
1360 | 288 |
} |