Skip to main content
summaryrefslogtreecommitdiffstats
blob: 19283aa7f455bb6c6a6d693aa026de8326fa2ee4 (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
/*******************************************************************************
 * 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 org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.p2.metadata.InstallableUnit;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.dialogs.PropertyPage;

/**
 * PropertyPage that shows an IU's properties
 * 
 * @since 3.4
 */
public class IUImplementationPropertyPage extends PropertyPage {

	private IUImplementationGroup iuGroup;

	protected Control createContents(Composite parent) {
		InstallableUnit iu = (InstallableUnit) getElement().getAdapter(InstallableUnit.class);
		if (iu == null) {
			Label label = new Label(parent, SWT.DEFAULT);
			label.setText(ProvUIMessages.IUPropertyPage_NoIUSelected);
		}
		iuGroup = new IUImplementationGroup(parent, iu, new ModifyListener() {
			public void modifyText(ModifyEvent event) {
				verifyComplete();
			}
		});
		Dialog.applyDialogFont(iuGroup.getComposite());
		verifyComplete();
		return iuGroup.getComposite();
	}

	public boolean performOk() {
		return true;
	}

	void verifyComplete() {
		if (iuGroup == null) {
			return;
		}
		IStatus status = iuGroup.verify();
		setValid(status.isOK());
	}
}

Back to the top