/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* 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:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.wgadesigner.dialogs;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import de.innovationgate.eclipse.wgadesigner.actions.OpenModulInBrowser;
public class ChooseContentStoreDialog extends TrayDialog {
private List<String> _contentStore;
private Combo _combo;
private IFile _modul;
public ChooseContentStoreDialog(Shell shell, List<String> contentStore,IFile modul) {
super(shell);
setHelpAvailable(false);
_contentStore = contentStore;
_modul=modul;
}
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.None);
GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);
composite.setLayoutData(data);
GridLayout layout = new GridLayout(1, false);
composite.setLayout(layout);
Label label = new Label(composite,SWT.NONE);
label.setLayoutData(data);
label.setText("Choose ContentStore");
_combo = new Combo(composite,SWT.BORDER | SWT.READ_ONLY);
_combo.setItems(_contentStore.toArray(new String[0]));
_combo.setLayoutData(GridDataFactory.copyData(data));
_combo.select(0);
return composite;
}
@Override
protected void okPressed() {
OpenModulInBrowser.openBrowser(_combo.getText(), _modul);
super.okPressed();
}
}