1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
15 package org.simantics.ui.workbench.dialogs;
17 import org.eclipse.jface.viewers.ILabelProvider;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.swt.widgets.Control;
20 import org.eclipse.swt.widgets.Shell;
21 import org.simantics.db.Resource;
25 * @author Toni Kalajainen
27 public class ResourceListDialog extends ElementListSelectionDialog {
29 public static final String DEFAULT_LABEL_SUFFIX = " (? = any character, * = any String)";
31 public ResourceListDialog(Shell parent, ILabelProvider labelProvider) {
32 super(parent, labelProvider);
35 public ResourceListDialog(Shell parent, String title, String label, ILabelProvider labelProvider) {
36 this(parent, labelProvider);
38 this.setMessage(label);
41 public ResourceListDialog(Shell parent, String title, ILabelProvider labelProvider) {
42 this(parent, labelProvider);
44 this.setMessage(title+DEFAULT_LABEL_SUFFIX);
48 protected Control createDialogArea(Composite parent) {
49 return super.createDialogArea(parent);
52 public Resource[] getResultResources()
54 Object res[] = getResult();
55 Resource result[] = new Resource[res.length];
56 for (int i=0; i<res.length; i++)
57 result[i] = (Resource) res[i];
61 public Resource getSingleResultResource()
63 return (Resource) getSingleResult();
66 public Object getSingleResult()
68 Object res[] = getResult();
69 if (res==null) return null;
70 if (res.length!=1) return null;