[Esbox-commits] r184 - in trunk/org.indt.esbox.launch/src/org/indt/esbox/launch: . internal internal/ui

raul at garage.maemo.org raul at garage.maemo.org
Fri Oct 26 15:14:03 EEST 2007


Author: raul
Date: 2007-10-26 15:14:02 +0300 (Fri, 26 Oct 2007)
New Revision: 184

Added:
   trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/
   trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/IESboxCDTLaunchConfigurationConstants.java
   trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/ui/
   trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/ui/ESboxCMainTab.java
Log:
option to run with standalone

Added: trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/IESboxCDTLaunchConfigurationConstants.java
===================================================================
--- trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/IESboxCDTLaunchConfigurationConstants.java	                        (rev 0)
+++ trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/IESboxCDTLaunchConfigurationConstants.java	2007-10-26 12:14:02 UTC (rev 184)
@@ -0,0 +1,10 @@
+package org.indt.esbox.launch.internal;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+
+public interface IESboxCDTLaunchConfigurationConstants extends ICDTLaunchConfigurationConstants {
+
+	public static final String ATTR_RUN_STANDALONE = ICDTLaunchConfigurationConstants.CDT_LAUNCH_ID + ".run_standalone"; //$NON-NLS-1$
+
+	public static final boolean RUN_STANDALONE_DEFAULT = true;
+}

Added: trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/ui/ESboxCMainTab.java
===================================================================
--- trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/ui/ESboxCMainTab.java	                        (rev 0)
+++ trunk/org.indt.esbox.launch/src/org/indt/esbox/launch/internal/ui/ESboxCMainTab.java	2007-10-26 12:14:02 UTC (rev 184)
@@ -0,0 +1,95 @@
+package org.indt.esbox.launch.internal.ui;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
+import org.eclipse.cdt.launch.ui.CMainTab;
+import org.eclipse.cdt.utils.pty.PTY;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.indt.esbox.core.ErrorLogger;
+import org.indt.esbox.launch.LaunchActivator;
+import org.indt.esbox.launch.internal.IESboxCDTLaunchConfigurationConstants;
+
+public class ESboxCMainTab extends CMainTab {
+
+	protected Button fRunStandaloneButton;
+	
+	public ESboxCMainTab() {
+		super(true);
+	}
+	
+	@Override
+	protected void createTerminalOption(Composite parent, int colSpan) {
+		Composite mainComp = new Composite(parent, SWT.NONE);
+		GridLayout mainLayout = new GridLayout();
+		mainLayout.numColumns = 1;
+		mainLayout.marginHeight = 0;
+		mainLayout.marginWidth = 0;
+		mainComp.setLayout(mainLayout);
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = colSpan;
+		mainComp.setLayoutData(gd);
+
+		fTerminalButton = createCheckButton(mainComp, LaunchMessages.getString("CMainTab.UseTerminal")); //$NON-NLS-1$
+		fTerminalButton.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent evt) {
+				updateLaunchConfigurationDialog();
+			}
+		});
+		fTerminalButton.setEnabled(PTY.isSupported());
+		
+		fRunStandaloneButton = createCheckButton(mainComp, "Run with \"run-standalone.sh\" script"); //$NON-NLS-1$
+		fRunStandaloneButton.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent evt) {
+				updateLaunchConfigurationDialog();
+			}
+		});
+		fRunStandaloneButton.setSelection(IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+	}
+	
+	@Override
+	public void performApply(ILaunchConfigurationWorkingCopy config) {
+		// TODO Auto-generated method stub
+		super.performApply(config);
+		config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE, fRunStandaloneButton.getSelection());
+	}
+	
+	@Override
+	public void initializeFrom(ILaunchConfiguration config) {
+		// TODO Auto-generated method stub
+		super.initializeFrom(config);
+		updateRunStandaloneFromConfig(config);
+	}
+	
+    protected void updateRunStandaloneFromConfig(ILaunchConfiguration config) {
+        boolean isRunStandalone = IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT;
+        try {
+        	isRunStandalone = config.getAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE,
+        			IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+        } catch (CoreException e) {
+            ErrorLogger errorLogger = LaunchActivator.getDefault().getErrorLogger();
+			errorLogger.logAndShowError("ESbox error", e);
+        }
+        fRunStandaloneButton.setSelection(isRunStandalone);
+    }
+    
+    @Override
+    public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+    	// TODO Auto-generated method stub
+    	super.setDefaults(config);
+    	config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE,
+    			IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+    }
+	
+	
+}



More information about the Esbox-commits mailing list