/*******************************************************************************
* Copyright (c) 2008, 2009 Symbian Software Systems 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:
* Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/
package org.eclipse.cdt.ui.dialogs;
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.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
/**
* <em>This class is not intended for use outside of CDT</em>
*
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class DocCommentOwnerComposite extends Composite {
protected DocCommentOwnerCombo fDocCombo;
protected Label desc, comboLabel;
protected Group group;
public DocCommentOwnerComposite(Composite parent, IDocCommentOwner initialOwner, String description, String label) {
super(parent, SWT.NONE);
GridLayout gl= new GridLayout();
gl.marginHeight= gl.marginWidth= 0;
setLayout(gl);
group = ControlFactory.createGroup(this, DialogsMessages.DocCommentOwnerComposite_DocumentationToolGroupTitle, 2);
group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
desc= new Label(group, SWT.WRAP);
GridData gd = GridDataFactory.fillDefaults().grab(false, false).span(2, 1).create();
gd.widthHint= 150;
desc.setText(description);
desc.setLayoutData(gd);
comboLabel= new Label(group, SWT.NONE);
comboLabel.setText(label);
fDocCombo= new DocCommentOwnerCombo(group, SWT.NONE, initialOwner) {};
gd = GridDataFactory.fillDefaults().grab(true, false).create();
fDocCombo.setLayoutData(gd);
}
public IDocCommentOwner getSelectedDocCommentOwner() {
return fDocCombo.getSelectedDocCommentOwner();
}
@Override
public void setEnabled(boolean enabled) {
desc.setEnabled(enabled);
comboLabel.setEnabled(enabled);
fDocCombo.setEnabled(enabled);
group.setEnabled(enabled);
}
}