private PkgCommandTarget target;
private String applicationId = "";
private PackageUtil pkgUtil = new PackageUtil(PlatformProjectUtil.getPkgType());
- private IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil
- .getPkgType());
+ private IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
private String rootstrapInstallLog = "";
private String deviceInstallLog = "";
this.monitor = monitor;
this.buildConfig = getBuildConfiguration();
}
-
+
@Override
public boolean process() throws CoreException {
boolean configurationIsSet = isSetProgramPath(launchConfig);
boolean isEflApp = PlatformProjectUtil.isEFLApplication(project);
-
+
if (configurationIsSet) {
if (isEflApp) {
- String appId = launchConfig.getAttribute(ITizenLaunchConfigurationConstants.ATTR_APPLICATION_ID, "");
+ String appId = launchConfig.getAttribute(
+ ITizenLaunchConfigurationConstants.ATTR_APPLICATION_ID, "");
killIfRunningApplication(appId);
}
- return installPackages(configurationIsSet, monitor);
- } else {
+ return installPackages(configurationIsSet, monitor);
+ } else {
monitor.beginTask("", 2);
try {
String descMsg = "";
if (!installPackages(configurationIsSet, new SubProgressMonitor(monitor, 1))) {
descMsg = "Installation seems to be failed. Check package installation log.";
}
- if (!setLaunchConfigurationForEFL(new SubProgressMonitor(monitor, 1), descMsg, isEflApp)) {
+ if (!setLaunchConfigurationForEFL(new SubProgressMonitor(monitor, 1), descMsg,
+ isEflApp)) {
return false;
}
} finally {
}
return true;
}
-
- private boolean _installPackages(List<IPackage> devicePkgs, List<IPackage> rootstrapPkgs,
- boolean reinstallOp, IProgressMonitor monitor) throws CoreException {
+
+ private boolean _installPackages(List<IPackage> devicePkgs, List<IPackage> rootstrapPkgs,
+ boolean reinstallOp, IProgressMonitor monitor) throws CoreException {
int totalWorks = 2;
monitor.beginTask("", totalWorks);
-
- IPkgLauncher pkgLauncher = PkgLauncherFactory.getLauncher(project, target,
- devicePkgs, rootstrapPkgs, reinstallOp);
+
+ IPkgLauncher pkgLauncher = PkgLauncherFactory.getLauncher(project, target, devicePkgs,
+ rootstrapPkgs, reinstallOp);
+ if (pkgLauncher == null) {
+ return false;
+ }
try {
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
pkgLauncher.debugLaunchPkgs(LaunchTypes.NONE, shell, new SubProgressMonitor(
rootstrapInstallLog = pkgLauncher.getRootstrapLog();
deviceInstallLog = pkgLauncher.getDeviceLog();
}
-
+
return true;
-
+
}
-
+
@SuppressWarnings("unchecked")
- private boolean installPackages(boolean configurationIsSet, IProgressMonitor monitor) throws CoreException {
+ private boolean installPackages(boolean configurationIsSet, IProgressMonitor monitor)
+ throws CoreException {
ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
List<IPackage> devicePackages = new ArrayList<IPackage>();
List<IPackage> rootstrapPackages = new ArrayList<IPackage>();
boolean reinstallOp = true;
-
+
if (configurationIsSet) {
IPkgModelMaker maker = PkgModelMakerFactory.getMaker(PlatformProjectUtil.getPkgType());
- List<String> devicePkgStr = wc.getAttribute(ITizenLaunchConfigurationConstants.ATTR_DEVICE_PACKAGE_LIST, new ArrayList<String>());
- List<String> rootstrapPkgStr = wc.getAttribute(ITizenLaunchConfigurationConstants.ATTR_ROOTSTRAP_PACKAGE_LIST, new ArrayList<String>());
+ List<String> devicePkgStr = wc.getAttribute(
+ ITizenLaunchConfigurationConstants.ATTR_DEVICE_PACKAGE_LIST,
+ new ArrayList<String>());
+ List<String> rootstrapPkgStr = wc.getAttribute(
+ ITizenLaunchConfigurationConstants.ATTR_ROOTSTRAP_PACKAGE_LIST,
+ new ArrayList<String>());
devicePackages.addAll(maker.makeModels(devicePkgStr));
rootstrapPackages.addAll(maker.makeModels(rootstrapPkgStr));
} else {
- List<IPackage> packages = pkgUtil.getPackages(project, buildConfig);
+ List<IPackage> packages = pkgUtil.getPackages(project, buildConfig);
if (!packages.isEmpty()) {
devicePackages.addAll(pkgFilter.filter(CmdTargetTypes.DEVICE, packages));
rootstrapPackages.addAll(pkgFilter.filter(CmdTargetTypes.ROOTSTRAP, packages));
}
setOptionAttributes(wc, devicePackages, rootstrapPackages, reinstallOp);
- }
- return _installPackages(devicePackages, rootstrapPackages, reinstallOp, monitor);
+ }
+ return _installPackages(devicePackages, rootstrapPackages, reinstallOp, monitor);
}
private boolean setLaunchConfigurationForEFL(IProgressMonitor monitor, final String descMsg,
final boolean isEflApp) throws CoreException {
monitor.beginTask("", 1);
- final ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
+ final ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
try {
SWTUtil.syncExec(new Runnable() {
@Override
public void run() {
- PlatformLaunchWizard wizard = new PlatformLaunchWizard(shell, launchConfig, project, buildConfig,
- target, mode, deviceInstallLog, rootstrapInstallLog, descMsg, isEflApp);
+ PlatformLaunchWizard wizard = new PlatformLaunchWizard(shell, launchConfig,
+ project, buildConfig, target, mode, deviceInstallLog,
+ rootstrapInstallLog, descMsg, isEflApp);
PlatformLaunchWizardDialog dlg = new PlatformLaunchWizardDialog(shell, wizard);
dlg.create();
if (Window.OK == dlg.open()) {
} finally {
monitor.done();
}
-
+
if (isSetProgramPath(launchConfig)) {
if (applicationId != null && !applicationId.isEmpty()) {
killIfRunningApplication(applicationId);
- }
+ }
return true;
} else {
return false;
}
}
-
+
protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc, String programPath,
- String arguments, String applicationId, List<IPackage> devicePackages, List<IPackage> rootstrapPackages,
- boolean reinstallOp, boolean selectPkgOp, Map<String, String> environments) {
+ String arguments, String applicationId, List<IPackage> devicePackages,
+ List<IPackage> rootstrapPackages, boolean reinstallOp, boolean selectPkgOp,
+ Map<String, String> environments) {
setOptionAttributes(wc, programPath, arguments, applicationId, environments);
setOptionAttributes(wc, devicePackages, rootstrapPackages, reinstallOp);
}
-
+
protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc, String programPath,
String arguments, String applicationId, Map<String, String> environments) {
if (programPath != null) {
wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, environments);
}
wc.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
-
+
try {
wc.doSave();
} catch (CoreException e) {
e.printStackTrace();
}
}
-
- protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc, List<IPackage> devicePackages, List<IPackage> rootstrapPackages,
- boolean reinstallOp) {
+
+ protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc,
+ List<IPackage> devicePackages, List<IPackage> rootstrapPackages, boolean reinstallOp) {
wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, reinstallOp);
if (devicePackages != null) {
List<String> strs = new ArrayList<String>();
strs.add(p.getPath());
}
wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_ROOTSTRAP_PACKAGE_LIST, strs);
- }
+ }
try {
wc.doSave();
} catch (CoreException e) {
e.printStackTrace();
}
}
-
+
protected boolean isSetProgramPath(ILaunchConfiguration wc) throws CoreException {
String path = wc.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
return !path.isEmpty();
}
-
+
protected void killIfRunningApplication(String appId) throws CoreException {
if (appId == null || appId.isEmpty()) {
return;
commander.killApp(appId);
}
}
-
- protected void newCoreException(String message, Throwable exception) throws CoreException {
+
+ protected void newCoreException(String message, Throwable exception) throws CoreException {
Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message, exception);
throw new CoreException(status);
}
-
+
protected IConfiguration getBuildConfiguration() {
- return PlatformConfigurationManager.getDefaultConfiguration(project);
+ return PlatformConfigurationManager.getDefaultConfiguration(project);
}
}
import java.util.Map;
import java.util.TreeMap;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.ui.AbstractDebugCheckboxSelectionDialog;
import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.MultipleInputDialog;
import org.eclipse.debug.internal.ui.launchConfigurations.EnvironmentVariable;
protected Button envSelectButton;
protected TableViewer environmentTable;
protected String[] envTableColumnHeaders = {
- LaunchConfigurationsMessages.EnvironmentTab_Variable_1,
- LaunchConfigurationsMessages.EnvironmentTab_Value_2,
- };
- protected static final String NAME_LABEL= LaunchConfigurationsMessages.EnvironmentTab_8;
- protected static final String VALUE_LABEL= LaunchConfigurationsMessages.EnvironmentTab_9;
-
+ LaunchConfigurationsMessages.EnvironmentTab_Variable_1,
+ LaunchConfigurationsMessages.EnvironmentTab_Value_2, };
+ protected static final String NAME_LABEL = LaunchConfigurationsMessages.EnvironmentTab_8;
+ protected static final String VALUE_LABEL = LaunchConfigurationsMessages.EnvironmentTab_9;
+
protected static final String TITLE = "Environment variable Configuration";
protected static final String P_VARIABLE = "variable"; //$NON-NLS-1$
protected static final String P_VALUE = "value"; //$NON-NLS-1$
composite.setLayout(new GridLayout(2, false));
createDescComposite(composite);
- //createTextAreaComposite(composite);
+ // createTextAreaComposite(composite);
createEnvironmentTable(composite);
createTableButtons(composite);
-
+
updateEnvironment();
return composite;
}
-
+
/**
* Updates the environment table for the given launch configuration
+ *
* @param configuration
*/
protected void updateEnvironment() {
environmentTable.setInput(defaultEnvMap);
}
-
- protected void createEnvironmentTable(Composite parent) {
- // Create table composite
+
+ protected void createEnvironmentTable(Composite parent) {
+ // Create table composite
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
layout.marginWidth = 0;
GridData gd = new GridData(GridData.FILL_BOTH);
composite.setLayoutData(gd);
// Create table
- environmentTable = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
+ environmentTable = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
+ | SWT.MULTI | SWT.FULL_SELECTION);
Table table = environmentTable.getTable();
table.setLayout(new GridLayout());
table.setLayoutData(new GridData(GridData.FILL_BOTH));
table.setLinesVisible(true);
environmentTable.setContentProvider(new EnvironmentVariableContentProvider());
environmentTable.setLabelProvider(new EnvironmentVariableLabelProvider());
- environmentTable.setColumnProperties(new String[] {P_VARIABLE, P_VALUE});
+ environmentTable.setColumnProperties(new String[] { P_VARIABLE, P_VALUE });
environmentTable.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
handleTableSelectionChanged(event);
Rectangle area = comp.getClientArea();
Point size = tref.computeSize(SWT.DEFAULT, SWT.DEFAULT);
ScrollBar vBar = tref.getVerticalBar();
- int width = area.width - tref.computeTrim(0,0,0,0).width - 2;
+ int width = area.width - tref.computeTrim(0, 0, 0, 0).width - 2;
if (size.y > area.height + tref.getHeaderHeight()) {
Point vBarSize = vBar.getSize();
width -= vBarSize.x;
}
Point oldSize = tref.getSize();
if (oldSize.x > area.width) {
- tc1.setWidth(width/2-1);
+ tc1.setWidth(width / 2 - 1);
tc2.setWidth(width - tc1.getWidth());
tref.setSize(area.width, area.height);
} else {
tref.setSize(area.width, area.height);
- tc1.setWidth(width/2-1);
+ tc1.setWidth(width / 2 - 1);
tc2.setWidth(width - tc1.getWidth());
}
}
});
}
-
+
/**
* Creates the add/edit/remove buttons for the environment table
- * @param parent the composite in which the buttons should be created
+ *
+ * @param parent
+ * the composite in which the buttons should be created
*/
protected void createTableButtons(Composite parent) {
// Create button composite
composite.setLayout(layout);
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
composite.setLayoutData(gd);
-
+
GridData btgd = new GridData(GridData.FILL_HORIZONTAL);
// Create buttons
envAddButton = new Button(composite, SWT.PUSH);
envAddButton.setLayoutData(btgd);
- envAddButton.setText(LaunchConfigurationsMessages.EnvironmentTab_New_4);
+ envAddButton.setText(LaunchConfigurationsMessages.EnvironmentTab_New_4);
envAddButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleEnvAddButtonSelected();
});
envSelectButton = new Button(composite, SWT.PUSH);
envSelectButton.setLayoutData(btgd);
- envSelectButton.setText(LaunchConfigurationsMessages.EnvironmentTab_18);
+ envSelectButton.setText(LaunchConfigurationsMessages.EnvironmentTab_18);
envSelectButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleEnvSelectButtonSelected();
});
envEditButton = new Button(composite, SWT.PUSH);
envEditButton.setLayoutData(btgd);
- envEditButton.setText(LaunchConfigurationsMessages.EnvironmentTab_Edit_5);
+ envEditButton.setText(LaunchConfigurationsMessages.EnvironmentTab_Edit_5);
envEditButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleEnvEditButtonSelected();
}
});
- envEditButton.setEnabled(false);
+ envEditButton.setEnabled(false);
envRemoveButton = new Button(composite, SWT.PUSH);
envRemoveButton.setLayoutData(btgd);
- envRemoveButton.setText(LaunchConfigurationsMessages.EnvironmentTab_Remove_6);
+ envRemoveButton.setText(LaunchConfigurationsMessages.EnvironmentTab_Remove_6);
envRemoveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleEnvRemoveButtonSelected();
});
envRemoveButton.setEnabled(false);
}
-
+
/**
* Responds to a selection changed event in the environment table
- * @param event the selection change event
+ *
+ * @param event
+ * the selection change event
*/
protected void handleTableSelectionChanged(SelectionChangedEvent event) {
- int size = ((IStructuredSelection)event.getSelection()).size();
+ int size = ((IStructuredSelection) event.getSelection()).size();
envEditButton.setEnabled(size == 1);
envRemoveButton.setEnabled(size > 0);
}
-
+
/**
* Adds a new environment variable to the table.
- */
+ */
protected void handleEnvAddButtonSelected() {
- MultipleInputDialog dialog = new MultipleInputDialog(getShell(), LaunchConfigurationsMessages.EnvironmentTab_22);
+ MultipleInputDialog dialog = new MultipleInputDialog(getShell(),
+ LaunchConfigurationsMessages.EnvironmentTab_22);
dialog.addTextField(NAME_LABEL, null, false);
dialog.addVariablesField(VALUE_LABEL, null, true);
-
+
if (dialog.open() != Window.OK) {
return;
}
-
+
String name = dialog.getStringValue(NAME_LABEL);
String value = dialog.getStringValue(VALUE_LABEL);
-
- if (name != null && value != null && name.length() > 0 && value.length() >0) {
+
+ if (name != null && value != null && name.length() > 0 && value.length() > 0) {
addVariable(new EnvironmentVariable(name.trim(), value.trim()));
updateAppendReplace();
}
}
-
+
/**
- * Displays a dialog that allows user to select native environment variables
+ * Displays a dialog that allows user to select native environment variables
* to add to the table.
*/
private void handleEnvSelectButtonSelected() {
- //get Environment Variables from the OS
+ // get Environment Variables from the OS
Map envVariables = getNativeEnvironment();
-
- //get Environment Variables from the table
+
+ // get Environment Variables from the table
TableItem[] items = environmentTable.getTable().getItems();
for (int i = 0; i < items.length; i++) {
EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
envVariables.remove(var.getName());
}
-
- NativeEnvironmentSelectionDialog dialog = new NativeEnvironmentSelectionDialog(getShell(), envVariables);
- dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20);
-
+
+ NativeEnvironmentSelectionDialog dialog = new NativeEnvironmentSelectionDialog(getShell(),
+ envVariables);
+ dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20);
+
int button = dialog.open();
if (button == Window.OK) {
- Object[] selected = dialog.getResult();
+ Object[] selected = dialog.getResult();
for (int i = 0; i < selected.length; i++) {
- environmentTable.add(selected[i]);
+ environmentTable.add(selected[i]);
}
}
-
- updateAppendReplace();
+
+ updateAppendReplace();
}
-
+
/**
* Removes the selected environment variable from the table.
- */
+ */
private void handleEnvRemoveButtonSelected() {
IStructuredSelection sel = (IStructuredSelection) environmentTable.getSelection();
environmentTable.getControl().setRedraw(false);
- for (Iterator i = sel.iterator(); i.hasNext(); ) {
- EnvironmentVariable var = (EnvironmentVariable) i.next();
- environmentTable.remove(var);
+ for (Iterator i = sel.iterator(); i.hasNext();) {
+ EnvironmentVariable var = (EnvironmentVariable) i.next();
+ environmentTable.remove(var);
}
environmentTable.getControl().setRedraw(true);
updateAppendReplace();
}
-
+
/**
- * Updates the enablement of the append/replace widgets. The
- * widgets should disable when there are no environment variables specified.
+ * Updates the enablement of the append/replace widgets. The widgets should
+ * disable when there are no environment variables specified.
*/
protected void updateAppendReplace() {
- //boolean enable= environmentTable.getTable().getItemCount() > 0;
- //appendEnvironment.setEnabled(enable);
- //replaceEnvironment.setEnabled(enable);
- }
-
+ // boolean enable= environmentTable.getTable().getItemCount() > 0;
+ // appendEnvironment.setEnabled(enable);
+ // replaceEnvironment.setEnabled(enable);
+ }
+
/**
* Creates an editor for the value of the selected environment variable.
*/
private void handleEnvEditButtonSelected() {
- IStructuredSelection sel= (IStructuredSelection) environmentTable.getSelection();
- EnvironmentVariable var= (EnvironmentVariable) sel.getFirstElement();
+ IStructuredSelection sel = (IStructuredSelection) environmentTable.getSelection();
+ EnvironmentVariable var = (EnvironmentVariable) sel.getFirstElement();
if (var == null) {
return;
}
- String originalName= var.getName();
- String value= var.getValue();
- MultipleInputDialog dialog= new MultipleInputDialog(getShell(), LaunchConfigurationsMessages.EnvironmentTab_11);
+ String originalName = var.getName();
+ String value = var.getValue();
+ MultipleInputDialog dialog = new MultipleInputDialog(getShell(),
+ LaunchConfigurationsMessages.EnvironmentTab_11);
dialog.addTextField(NAME_LABEL, originalName, false);
dialog.addVariablesField(VALUE_LABEL, value, true);
-
+
if (dialog.open() != Window.OK) {
return;
}
- String name= dialog.getStringValue(NAME_LABEL);
- value= dialog.getStringValue(VALUE_LABEL);
+ String name = dialog.getStringValue(NAME_LABEL);
+ value = dialog.getStringValue(VALUE_LABEL);
if (!originalName.equals(name)) {
if (addVariable(new EnvironmentVariable(name, value))) {
environmentTable.remove(var);
environmentTable.update(var, null);
}
}
-
+
/**
- * Attempts to add the given variable. Returns whether the variable
- * was added or not (as when the user answers not to overwrite an
- * existing variable).
- * @param variable the variable to add
+ * Attempts to add the given variable. Returns whether the variable was
+ * added or not (as when the user answers not to overwrite an existing
+ * variable).
+ *
+ * @param variable
+ * the variable to add
* @return whether the variable was added
*/
protected boolean addVariable(EnvironmentVariable variable) {
- String name= variable.getName();
+ String name = variable.getName();
TableItem[] items = environmentTable.getTable().getItems();
for (int i = 0; i < items.length; i++) {
EnvironmentVariable existingVariable = (EnvironmentVariable) items[i].getData();
if (existingVariable.getName().equals(name)) {
- boolean overWrite= MessageDialog.openQuestion(getShell(), LaunchConfigurationsMessages.EnvironmentTab_12, MessageFormat.format(LaunchConfigurationsMessages.EnvironmentTab_13, new String[] {name})); //
+ boolean overWrite = MessageDialog.openQuestion(getShell(),
+ LaunchConfigurationsMessages.EnvironmentTab_12, MessageFormat.format(
+ LaunchConfigurationsMessages.EnvironmentTab_13,
+ new String[] { name })); //
if (!overWrite) {
return false;
}
@Override
protected void okPressed() {
- // Convert the table's items into a Map so that this can be saved in the
+ // Convert the table's items into a Map so that this can be saved in the
// configuration's attributes.
TableItem[] items = environmentTable.getTable().getItems();
envMap = new HashMap(items.length);
- for (int i = 0; i < items.length; i++)
- {
+ for (int i = 0; i < items.length; i++) {
EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
envMap.put(var.getName(), var.getValue());
}
super.okPressed();
}
-
+
public Map getEnvs() {
return envMap;
}
-
+
/**
* Content provider for the environment table
*/
protected class EnvironmentVariableContentProvider implements IStructuredContentProvider {
public Object[] getElements(Object inputElement) {
EnvironmentVariable[] elements = new EnvironmentVariable[0];
- //ILaunchConfiguration config = (ILaunchConfiguration) inputElement;
- Map m = (Map)inputElement;
- /*
- try {
- m = config.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null);
- } catch (CoreException e) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Error reading configuration", e)); //$NON-NLS-1$
- return elements;
- }
- */
+ Map m = (Map) inputElement;
if (m != null && !m.isEmpty()) {
elements = new EnvironmentVariable[m.size()];
String[] varNames = new String[m.size()];
}
return elements;
}
+
public void dispose() {
}
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput == null){
+ if (newInput == null) {
return;
}
- if (viewer instanceof TableViewer){
- TableViewer tableViewer= (TableViewer) viewer;
+ if (viewer instanceof TableViewer) {
+ TableViewer tableViewer = (TableViewer) viewer;
if (tableViewer.getTable().isDisposed()) {
return;
}
} else if (e2 == null) {
return 1;
} else {
- return ((EnvironmentVariable)e1).getName().compareToIgnoreCase(((EnvironmentVariable)e2).getName());
+ return ((EnvironmentVariable) e1).getName().compareToIgnoreCase(
+ ((EnvironmentVariable) e2).getName());
}
}
});
}
}
}
-
+
/**
* Label provider for the environment table
*/
- public class EnvironmentVariableLabelProvider extends LabelProvider implements ITableLabelProvider {
- public String getColumnText(Object element, int columnIndex) {
+ public class EnvironmentVariableLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+ public String getColumnText(Object element, int columnIndex) {
String result = null;
if (element != null) {
EnvironmentVariable var = (EnvironmentVariable) element;
switch (columnIndex) {
- case 0: // variable
- result = var.getName();
- break;
- case 1: // value
- result = var.getValue();
- break;
+ case 0: // variable
+ result = var.getName();
+ break;
+ case 1: // value
+ result = var.getValue();
+ break;
}
}
return result;
}
+
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == 0) {
return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_ENV_VAR);
}
/**
- * Gets native environment variable from the LaunchManager. Creates EnvironmentVariable objects.
- * @return Map of name - EnvironmentVariable pairs based on native environment.
+ * Gets native environment variable from the LaunchManager. Creates
+ * EnvironmentVariable objects.
+ *
+ * @return Map of name - EnvironmentVariable pairs based on native
+ * environment.
*/
private Map getNativeEnvironment() {
- Map stringVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironmentCasePreserved();
+ Map stringVars = DebugPlugin.getDefault().getLaunchManager()
+ .getNativeEnvironmentCasePreserved();
HashMap vars = new HashMap();
- for (Iterator i = stringVars.keySet().iterator(); i.hasNext(); ) {
+ for (Iterator i = stringVars.keySet().iterator(); i.hasNext();) {
String key = (String) i.next();
String value = (String) stringVars.get(key);
vars.put(key, new EnvironmentVariable(key, value));
}
return vars;
}
-
+
/**
- * This dialog allows users to select one or more known native environment variables from a list.
+ * This dialog allows users to select one or more known native environment
+ * variables from a list.
*/
- private class NativeEnvironmentSelectionDialog extends AbstractDebugCheckboxSelectionDialog {
-
+ private static class NativeEnvironmentSelectionDialog extends
+ AbstractDebugCheckboxSelectionDialog {
+
private Object fInput;
-
+
public NativeEnvironmentSelectionDialog(Shell parentShell, Object input) {
super(parentShell);
fInput = input;
setShellStyle(getShellStyle() | SWT.RESIZE);
setShowSelectAllButtons(true);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getDialogSettingsId()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.internal.ui.launchConfigurations.
+ * AbstractDebugSelectionDialog#getDialogSettingsId()
*/
protected String getDialogSettingsId() {
return IDebugUIConstants.PLUGIN_ID + ".ENVIRONMENT_TAB.NATIVE_ENVIROMENT_DIALOG"; //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getHelpContextId()
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.internal.ui.launchConfigurations.
+ * AbstractDebugSelectionDialog#getHelpContextId()
*/
protected String getHelpContextId() {
return IDebugHelpContextIds.SELECT_NATIVE_ENVIRONMENT_DIALOG;
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerInput()
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.internal.ui.launchConfigurations.
+ * AbstractDebugSelectionDialog#getViewerInput()
*/
protected Object getViewerInput() {
return fInput;
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerLabel()
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.internal.ui.launchConfigurations.
+ * AbstractDebugSelectionDialog#getViewerLabel()
*/
protected String getViewerLabel() {
return LaunchConfigurationsMessages.EnvironmentTab_19;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getLabelProvider()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.internal.ui.launchConfigurations.
+ * AbstractDebugSelectionDialog#getLabelProvider()
*/
protected IBaseLabelProvider getLabelProvider() {
return new ILabelProvider() {
public Image getImage(Object element) {
return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_ENVIRONMENT);
}
+
public String getText(Object element) {
EnvironmentVariable var = (EnvironmentVariable) element;
- return MessageFormat.format(LaunchConfigurationsMessages.EnvironmentTab_7, new String[] {var.getName(), var.getValue()});
+ return MessageFormat.format(LaunchConfigurationsMessages.EnvironmentTab_7,
+ new String[] { var.getName(), var.getValue() });
}
+
public void addListener(ILabelProviderListener listener) {
}
+
public void dispose() {
}
+
public boolean isLabelProperty(Object element, String property) {
return false;
}
+
public void removeListener(ILabelProviderListener listener) {
- }
+ }
};
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getContentProvider()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.internal.ui.launchConfigurations.
+ * AbstractDebugSelectionDialog#getContentProvider()
*/
protected IContentProvider getContentProvider() {
return new IStructuredContentProvider() {
if (inputElement instanceof HashMap) {
Comparator comparator = new Comparator() {
public int compare(Object o1, Object o2) {
- String s1 = (String)o1;
- String s2 = (String)o2;
+ String s1 = (String) o1;
+ String s2 = (String) o2;
return s1.compareTo(s2);
}
};
TreeMap envVars = new TreeMap(comparator);
- envVars.putAll((Map)inputElement);
+ envVars.putAll((Map) inputElement);
elements = new EnvironmentVariable[envVars.size()];
int index = 0;
for (Iterator iterator = envVars.keySet().iterator(); iterator.hasNext(); index++) {
}
return elements;
}
- public void dispose() {
+
+ public void dispose() {
}
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
};