blob: b631ed49bba0578e2d0c38aaa858b0f90b79398d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*******************************************************************************
* Copyright (c) 2007 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.equinox.p2.ui.dialogs;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.p2.core.repository.IRepository;
import org.eclipse.equinox.p2.ui.ProvUI;
import org.eclipse.equinox.p2.ui.operations.AddColocatedRepositoryOperation;
import org.eclipse.equinox.p2.ui.operations.ProvisioningOperation;
import org.eclipse.swt.widgets.Shell;
/**
* Dialog that allows colocated metadata and artifact repositories
* to be defined and added.
*
* @since 3.4
*
*/
public class AddColocatedRepositoryDialog extends AddRepositoryDialog {
public AddColocatedRepositoryDialog(Shell parentShell, IRepository[] knownRepositories) {
super(parentShell, knownRepositories);
}
protected ProvisioningOperation getOperation(URL url, String name) {
return new AddColocatedRepositoryOperation(getShell().getText(), url, name);
}
protected URL makeRepositoryURL(String urlString) {
URL newURL;
try {
newURL = new URL(urlString);
} catch (MalformedURLException e) {
// TODO need friendlier user message rather than just reporting exception
ProvUI.handleException(e, ProvUIMessages.AddColocatedRepositoryDialog_InvalidURL);
return null;
}
String urlSpec = newURL.toExternalForm();
try {
if (!urlSpec.endsWith("/")) //$NON-NLS-1$
urlSpec += "/"; //$NON-NLS-1$
newURL = new URL(urlSpec);
} catch (MalformedURLException e) {
return null;
}
return newURL;
}
protected String repositoryFileName() {
return null;
}
protected boolean repositoryIsFile() {
return false;
}
}
|