eclipse plugin: Implement the GUI for the...

...project's property page
This commit is contained in:
Timotei Dolean 2011-06-20 15:33:22 +00:00
parent 4a46cf94be
commit 88a748a99e
2 changed files with 50 additions and 2 deletions

View file

@ -805,6 +805,7 @@
point="org.eclipse.ui.propertyPages">
<page
class="org.wesnoth.propertypages.WesnothProjectPage"
icon="icons/wesnoth-icon_16.png"
id="org.wesnoth.propertyPages.wesnothProject"
name="Wesnoth Project"
objectClass="org.eclipse.core.resources.IProject">

View file

@ -1,13 +1,24 @@
package org.wesnoth.propertypages;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
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.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbenchPropertyPage;
import org.eclipse.ui.dialogs.PropertyPage;
import org.wesnoth.utils.WesnothInstallsUtils;
import org.wesnoth.utils.WesnothInstallsUtils.WesnothInstall;
public class WesnothProjectPage extends PropertyPage implements IWorkbenchPropertyPage
{
private Combo cmbInstall_;
public WesnothProjectPage()
{
}
@ -15,6 +26,42 @@ public class WesnothProjectPage extends PropertyPage implements IWorkbenchProper
@Override
protected Control createContents( Composite parent )
{
return null;
Composite newComposite = new Composite( parent, 0 );
newComposite.setLayout(new FillLayout(SWT.VERTICAL));
Group grpGeneral = new Group(newComposite, SWT.NONE);
grpGeneral.setText("General");
grpGeneral.setLayout(new GridLayout(2, false));
Label lblNewLabel = new Label(grpGeneral, SWT.NONE);
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel.setText("Wesnoth install:");
cmbInstall_ = new Combo(grpGeneral, SWT.READ_ONLY );
cmbInstall_.setItems(new String[] {"Default"});
cmbInstall_.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
cmbInstall_.select(0);
// fill the installs
List<WesnothInstall> installs = WesnothInstallsUtils.getInstalls( );
for ( WesnothInstall wesnothInstall : installs )
{
if ( wesnothInstall.Name.equalsIgnoreCase( "Default" ) )
continue;
cmbInstall_.add( wesnothInstall.Name );
}
return newComposite;
}
@Override
public boolean performOk()
{
// save settings.
return true;
}
}