From fa78098beebe3f9bb92c98cbc0f40f40393d2c42 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Tue, 13 Oct 2009 20:32:26 +0000 Subject: [PATCH] Simplified LaunchElement to a PODS (plain old data structure) --- ...ltiLaunchConfigurationSelectionDialog.java | 8 ++-- .../ui/MultiLaunchConfigurationTabGroup.java | 44 ++++++++++--------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/MultiLaunchConfigurationSelectionDialog.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/MultiLaunchConfigurationSelectionDialog.java index f442debe6f8..8934df80acf 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/MultiLaunchConfigurationSelectionDialog.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/MultiLaunchConfigurationSelectionDialog.java @@ -359,10 +359,10 @@ public class MultiLaunchConfigurationSelectionDialog extends TitleAreaDialog imp } public void setInitialSelection(LaunchElement el) { - action = el.getAction(); - actionParam = el.getActionParam(); - isDefaultMode = el.getMode().equals(MultiLaunchConfigurationDelegate.DEFAULT_MODE); - fInitialSelection = new StructuredSelection(el.getData()); + action = el.action; + actionParam = el.actionParam; + isDefaultMode = el.mode.equals(MultiLaunchConfigurationDelegate.DEFAULT_MODE); + fInitialSelection = new StructuredSelection(el.data); fSelection = fInitialSelection; } } diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/MultiLaunchConfigurationTabGroup.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/MultiLaunchConfigurationTabGroup.java index d21d9dbb0f9..95ffbcfcb69 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/MultiLaunchConfigurationTabGroup.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/MultiLaunchConfigurationTabGroup.java @@ -93,13 +93,13 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio return null; if (columnIndex == 0) { MultiLaunchConfigurationDelegate.LaunchElement el = (MultiLaunchConfigurationDelegate.LaunchElement) element; - if (el.getData() == null) { + if (el.data == null) { Image errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); return errorImage; } try { - String key = el.getData().getType().getIdentifier(); + String key = el.data.getType().getIdentifier(); return DebugPluginImages.getImage(key); } catch (CoreException e) { Image errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); @@ -117,26 +117,26 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio // launch name if (columnIndex == 0) { try { - return (el.getData() != null) ? el.getData().getType().getName() + "::" + el.getName() : el.getName(); //$NON-NLS-1$ + return (el.data != null) ? el.data.getType().getName() + "::" + el.name : el.name; //$NON-NLS-1$ } catch (CoreException e) { - return el.getName(); + return el.name; } } // launch mode if (columnIndex == 1) - return el.getMode(); + return el.mode; // launch post action if (columnIndex == 2) { - EPostLaunchAction action = el.getAction(); + EPostLaunchAction action = el.action; switch (action) { case NONE: return ""; //$NON-NLS-1$ case WAIT_FOR_TERMINATION: return LaunchMessages.getString("MultiLaunchConfigurationDelegate.Action.WaitUntilTerminated"); //$NON-NLS-1$ case DELAY: - final Object actionParam = el.getActionParam(); + final Object actionParam = el.actionParam; return LaunchMessages.getFormattedString("MultiLaunchConfigurationTabGroup.13", //$NON-NLS-1$ actionParam instanceof Integer ? Integer.toString((Integer)actionParam) : "?"); //$NON-NLS-1$ default: @@ -260,14 +260,15 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio for (ILaunchConfiguration config : configs) { MultiLaunchConfigurationDelegate.LaunchElement el = new MultiLaunchConfigurationDelegate.LaunchElement(); input.add(el); - el.setIndex(input.size() - 1); - el.setEnabled(true); - el.setName(config.getName()); - el.setData(config); - el.setMode(dialog.getMode()); - el.setAction(dialog.getAction(), dialog.getActionParam()); + el.index = input.size() - 1; + el.enabled = true; + el.name = config.getName(); + el.data = config; + el.mode = dialog.getMode(); + el.action = dialog.getAction(); + el.actionParam = dialog.getActionParam(); treeViewer.refresh(true); - treeViewer.setChecked(el, el.isEnabled()); + treeViewer.setChecked(el, el.enabled); } updateWidgetEnablement(); updateLaunchConfigurationDialog(); @@ -290,17 +291,18 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio MultiLaunchConfigurationDelegate.LaunchElement el = input.get(index); MultiLaunchConfigurationSelectionDialog dialog = MultiLaunchConfigurationSelectionDialog.createDialog( - treeViewer.getControl().getShell(), el.getMode(), true); + treeViewer.getControl().getShell(), el.mode, true); dialog.setInitialSelection(el); if (dialog.open() == Dialog.OK) { ILaunchConfiguration[] confs = dialog.getSelectedLaunchConfigurations(); if (confs.length < 0) return; assert confs.length == 1 : "invocation of the dialog for editing an entry sholdn't allow OK to be hit if the user chooses multiple launch configs in the dialog"; //$NON-NLS-1$ - el.setName(confs[0].getName()); - el.setData(confs[0]); - el.setMode(dialog.getMode()); - el.setAction(dialog.getAction(), dialog.getActionParam()); + el.name = confs[0].getName(); + el.data = confs[0]; + el.mode = dialog.getMode(); + el.action = dialog.getAction(); + el.actionParam = dialog.getActionParam(); treeViewer.refresh(true); updateWidgetEnablement(); updateLaunchConfigurationDialog(); @@ -405,7 +407,7 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio treeViewer.addCheckStateListener(new ICheckStateListener(){ public void checkStateChanged(CheckStateChangedEvent event) { - ((LaunchElement)event.getElement()).setEnabled(event.getChecked()); + ((LaunchElement)event.getElement()).enabled = event.getChecked(); updateLaunchConfigurationDialog(); } }); @@ -424,7 +426,7 @@ public class MultiLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio if (treeViewer != null) { for (Iterator iterator = input.iterator(); iterator.hasNext();) { MultiLaunchConfigurationDelegate.LaunchElement el = iterator.next(); - treeViewer.setChecked(el, el.isEnabled()); + treeViewer.setChecked(el, el.enabled); } treeViewer.refresh(true); }