summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2008-12-01 16:49:29 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2008-12-01 16:49:29 +0000
commitdb4394f518fb6217b6f6d3fdfef509b8fc41054d (patch)
tree35c9836db7da95e77e18c4d2b756518d4aed1462
parentAdded toolchains for Cygwin and MinGW. (diff)
downloadrtems-eclipse-plug-in-db4394f518fb6217b6f6d3fdfef509b8fc41054d.tar.bz2
Updated the wizard page.
-rw-r--r--org.rtems.cdt.toolchain2/org/rtems/cdt/Storage.java6
-rw-r--r--org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/BasicSetup.java141
-rw-r--r--org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/FinishSetup.java31
-rw-r--r--org.rtems.cdt.toolchain2/plugin.xml2
4 files changed, 84 insertions, 96 deletions
diff --git a/org.rtems.cdt.toolchain2/org/rtems/cdt/Storage.java b/org.rtems.cdt.toolchain2/org/rtems/cdt/Storage.java
index 155e1a7..3fde958 100644
--- a/org.rtems.cdt.toolchain2/org/rtems/cdt/Storage.java
+++ b/org.rtems.cdt.toolchain2/org/rtems/cdt/Storage.java
@@ -39,7 +39,11 @@ public class Storage {
private static final int EXPECT_KEY = 2;
private static final int TOOL_COMPLETE = 3;
- ;
+
+ public static String getPreference( String key) {
+ return Activator.getDefault().getPreferenceStore().getString( key);
+ }
+
public static String getPristineProperty( IProject project, String key) {
String value = null;
diff --git a/org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/BasicSetup.java b/org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/BasicSetup.java
index 01abd88..b622a29 100644
--- a/org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/BasicSetup.java
+++ b/org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/BasicSetup.java
@@ -12,7 +12,6 @@
package org.rtems.cdt.wizards;
-import java.util.*;
import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage;
import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -22,38 +21,22 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.SWT;
+import org.rtems.cdt.Constants;
+import org.rtems.cdt.Storage;
public class BasicSetup extends MBSCustomPage {
- public static final String PAGE_ID = "org.rtems.cdt.wizards.basicsetup";
+ public static final String PAGE_ID = "org.rtems.cdt.wizards.BasicSetup";
- private SortedMap<String, String> mTargetMap;
+ public static final String BROWSE = " &Browse... ";
private Composite mComposite;
- private Text mInstallationPath;
+ private Text mBasePath;
- private Text mVersion;
-
- private Combo mTarget;
+ private Text mBSPPath;
public BasicSetup() {
pageID = PAGE_ID;
-
- mTargetMap = new TreeMap<String, String>();
- mTargetMap.put( new String( "PowerPC"), new String ("powerpc"));
- mTargetMap.put( new String( "ARM"), new String ("arm"));
- mTargetMap.put( new String( "SPARC"), new String ("sparc"));
- mTargetMap.put( new String( "Motorola 68k or Freescale ColdFire"), new String ("m68k"));
- mTargetMap.put( new String( "Intel i386"), new String ("i368"));
- mTargetMap.put( new String( "Intel i686"), new String ("i668"));
- mTargetMap.put( new String( "AVR"), new String ("avr"));
- mTargetMap.put( new String( "Blackfin"), new String ("bfin"));
- mTargetMap.put( new String( "Hitachi H8300"), new String ("h8300"));
- mTargetMap.put( new String( "MIPS"), new String ("mips"));
- mTargetMap.put( new String( "SuperH"), new String ("sh"));
-
- //IProject project = ((NewCProjectWizard) getWizard()).getNewProject();
- //MBSCustomPageManager.addPageProperty( PAGE_ID, "project", project);
}
public boolean canFlipToNextPage() {
@@ -65,8 +48,8 @@ public class BasicSetup extends MBSCustomPage {
}
public void createControl( Composite parent) {
- // Create UI elements
- mComposite = new Composite( parent, SWT.NULL);
+ // Create base widget
+ mComposite = new Composite( parent, SWT.NONE);
GridData gd = new GridData( GridData.FILL_BOTH);
mComposite.setLayoutData( gd);
@@ -75,87 +58,63 @@ public class BasicSetup extends MBSCustomPage {
layout.numColumns = 3;
mComposite.setLayout( layout);
+ // Base path
Label label = new Label( mComposite, SWT.LEFT);
- label.setText( "Installation path:");
- gd = new GridData( GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- label.setLayoutData( gd);
+ label.setText( "Base path:");
- mInstallationPath = new Text( mComposite, SWT.LEFT | SWT.BORDER);
- mInstallationPath.setText( "/opt/rtems-4.10");
+ mBasePath = new Text( mComposite, SWT.LEFT | SWT.BORDER);
+ mBasePath.setText( Storage.getPreference( Constants.BASE_PATH_KEY));
gd = new GridData( GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- mInstallationPath.setLayoutData( gd);
+ mBasePath.setLayoutData( gd);
Button button = new Button( mComposite, SWT.PUSH);
- button.setText( "Browse");
+ button.setText( BROWSE);
button.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected( SelectionEvent e) {
- browseForInstallationPath();
+ browseForPath( mBasePath);
}
}
);
-
- label = new Label( mComposite, SWT.LEFT);
- label.setText( "Version:");
- gd = new GridData( GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- label.setLayoutData( gd);
-
- mVersion = new Text( mComposite, SWT.RIGHT | SWT.BORDER);
- mVersion.setText( "4.10");
- gd = new GridData( GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- mVersion.setLayoutData( gd);
-
- new Label( mComposite, SWT.NONE);
+ // BSP path
label = new Label( mComposite, SWT.LEFT);
- label.setText( "Target architecture:");
- gd = new GridData( GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- label.setLayoutData( gd);
+ label.setText( "BSP path:");
- mTarget = new Combo( mComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
- Iterator<String> targets = mTargetMap.keySet().iterator();
- while (targets.hasNext()) {
- mTarget.add( (String) targets.next());
- }
- mTarget.select( mTarget.indexOf( "PowerPC"));
+ mBSPPath = new Text( mComposite, SWT.LEFT | SWT.BORDER);
+ mBSPPath.setText( Storage.getPreference( Constants.BSP_PATH_KEY));
gd = new GridData( GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- mTarget.setLayoutData( gd);
+ mBSPPath.setLayoutData( gd);
- new Label( mComposite, SWT.NONE);
+ button = new Button( mComposite, SWT.PUSH);
+ button.setText( BROWSE);
+ button.addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected( SelectionEvent e) {
+ browseForPath( mBSPPath);
+ }
+ }
+ );
// Connect user input
- mInstallationPath.addModifyListener(
+ mBasePath.addModifyListener(
new ModifyListener() {
public void modifyText( ModifyEvent e) {
- installationPathChanged();
+ basePathChanged();
}
}
);
- mVersion.addModifyListener(
+ mBSPPath.addModifyListener(
new ModifyListener() {
public void modifyText( ModifyEvent e) {
- versionChanged();
- }
- }
- );
- mTarget.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e) {
- targetChanged();
+ bspPathChanged();
}
}
);
// Trigger initial setup
- installationPathChanged();
- versionChanged();
- targetChanged();
+ basePathChanged();
+ bspPathChanged();
}
public void dispose() {
@@ -167,7 +126,7 @@ public class BasicSetup extends MBSCustomPage {
}
public String getDescription() {
- return "WARNING: This page is not useful.";
+ return "Select the RTEMS base installation path and the board support package (BSP) installation path.";
}
public String getErrorMessage() {
@@ -183,7 +142,7 @@ public class BasicSetup extends MBSCustomPage {
}
public String getTitle() {
- return "Basic Setup";
+ return "RTEMS Setup";
}
public void performHelp() {
@@ -198,7 +157,7 @@ public class BasicSetup extends MBSCustomPage {
// Do nothing
}
- public void setTitle(String title) {
+ public void setTitle( String title) {
// Do nothing
}
@@ -210,24 +169,20 @@ public class BasicSetup extends MBSCustomPage {
return true;
}
- private void browseForInstallationPath() {
+ private void browseForPath( Text text) {
DirectoryDialog dialog = new DirectoryDialog( mComposite.getShell(), SWT.NONE);
- dialog.setFilterPath( mInstallationPath.getText());
- String text = dialog.open();
- if (text != null) {
- mInstallationPath.setText( text);
+ dialog.setFilterPath( text.getText());
+ String path = dialog.open();
+ if (path != null) {
+ text.setText( path);
}
}
- private void installationPathChanged() {
- MBSCustomPageManager.addPageProperty( pageID, "installationPath", mInstallationPath.getText());
- }
-
- private void versionChanged() {
- MBSCustomPageManager.addPageProperty( pageID, "version", mVersion.getText());
- }
+ private void basePathChanged() {
+ MBSCustomPageManager.addPageProperty( pageID, Constants.BASE_PATH_KEY, mBasePath.getText());
+ }
- private void targetChanged() {
- MBSCustomPageManager.addPageProperty( pageID, "target", mTarget.getText());
+ private void bspPathChanged() {
+ MBSCustomPageManager.addPageProperty( pageID, Constants.BSP_PATH_KEY, mBSPPath.getText());
}
} \ No newline at end of file
diff --git a/org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/FinishSetup.java b/org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/FinishSetup.java
index e0d2407..d891c83 100644
--- a/org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/FinishSetup.java
+++ b/org.rtems.cdt.toolchain2/org/rtems/cdt/wizards/FinishSetup.java
@@ -12,8 +12,37 @@
package org.rtems.cdt.wizards;
+import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
+import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.rtems.cdt.Constants;
+import org.rtems.cdt.Storage;
+
public class FinishSetup implements Runnable {
public void run() {
- // TODO
+ // Get a handle to the wizard
+ IWizardPage [] pages = MBSCustomPageManager.getPages();
+
+ if (pages != null && pages.length > 0) {
+ // Get last project
+ CDTCommonProjectWizard wizard = (CDTCommonProjectWizard) pages [0].getWizard();
+ IProject project = wizard.getLastProject();
+
+ // Get wizard values
+ String basePath = (String) MBSCustomPageManager.getPageProperty(
+ BasicSetup.PAGE_ID, Constants.BASE_PATH_KEY
+ );
+ String bspPath = (String) MBSCustomPageManager.getPageProperty(
+ BasicSetup.PAGE_ID, Constants.BSP_PATH_KEY
+ );
+
+ // Set project properties
+ Storage.setProperty( project, Constants.BASE_PATH_KEY, basePath);
+ Storage.setProperty( project, Constants.BSP_PATH_KEY, bspPath);
+
+ // Update tools
+ Storage.updateTools( project);
+ }
}
}
diff --git a/org.rtems.cdt.toolchain2/plugin.xml b/org.rtems.cdt.toolchain2/plugin.xml
index 16849ad..f8a5ac8 100644
--- a/org.rtems.cdt.toolchain2/plugin.xml
+++ b/org.rtems.cdt.toolchain2/plugin.xml
@@ -419,7 +419,7 @@
<extension
point="org.eclipse.cdt.managedbuilder.ui.newWizardPages">
<wizardPage
- ID="org.rtems.cdt.wizards.basicsetup"
+ ID="org.rtems.cdt.wizards.BasicSetup"
operationClass="org.rtems.cdt.wizards.FinishSetup"
pageClass="org.rtems.cdt.wizards.BasicSetup"/>
</extension>