Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 241b5b78dafe80c2d07792f590ed48ff6a1df98c (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
/*******************************************************************************
 * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) 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:
 *     Soyatec - initial API and implementation
 *******************************************************************************/
package org.eclipse.papyrus.xwt.jface;

import java.net.URL;

import org.eclipse.papyrus.xwt.IConstants;
import org.eclipse.swt.widgets.Shell;

/**
 * Default XWT Dialog with a content via static URL
 * 
 * @author yyang <yves.yang@soyatec.com>
 */
public class XWTDialog extends AbstractDialog {

	private Class<?> contentForm;

	public XWTDialog(Shell parentShell, String title, Object dataContext, Class<?> contentForm) {
		super(parentShell, title, dataContext);
		this.contentForm = contentForm;
	}

	@Override
	protected URL getContentURL() {
		if(contentForm != null) {
			return contentForm.getResource(contentForm.getSimpleName() + IConstants.XWT_EXTENSION_SUFFIX);
		}
		return null;
	}

	@Override
	protected ClassLoader getClassLoader() {
		return contentForm.getClassLoader();
	}
}

Back to the top