Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/WipRemoteTab.java

Issue 10829181: Redesign TabBase to get rid of mandatory inheritance of dialog element interfaces (Closed) Base URL: https://chromedevtools.googlecode.com/svn/trunk
Patch Set: fcr Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/TabBase.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/WipRemoteTab.java
diff --git a/plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/WipRemoteTab.java b/plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/WipRemoteTab.java
index 0bb64b223e04133f174d6b3f0c35b1e1249e2b3f..b74ad2ce2bcb618f818adbd2a9d1a15032c65111 100644
--- a/plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/WipRemoteTab.java
+++ b/plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/WipRemoteTab.java
@@ -19,10 +19,7 @@ import org.chromium.sdk.wip.WipBackend;
import org.chromium.sdk.wip.eclipse.BackendRegistry;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.PreferenceStore;
-import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -46,8 +43,9 @@ class WipRemoteTab extends ChromiumRemoteTab<WipRemoteTab.WipTabElements> {
}
}
- interface WipTabElements extends ChromiumRemoteTab.TabElements {
+ interface WipTabElements {
BackendSelectorControl getBackendSelector();
+ ChromiumRemoteTab.TabElements getBase();
}
@Override
@@ -77,38 +75,26 @@ class WipRemoteTab extends ChromiumRemoteTab<WipRemoteTab.WipTabElements> {
backendSelector.getMainControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
return new WipTabElements() {
- @Override public StringFieldEditor getHost() {
- return basicElements.getHost();
- }
- @Override public IntegerFieldEditor getPort() {
- return basicElements.getPort();
- }
- @Override public BooleanFieldEditor getAddNetworkConsole() {
- return basicElements.getAddNetworkConsole();
- }
- @Override public RadioButtonsLogic<Integer> getBreakpointRadioButtons() {
- return basicElements.getBreakpointRadioButtons();
- }
@Override public BackendSelectorControl getBackendSelector() {
return backendSelector;
}
+ @Override
+ public TabElements getBase() {
+ return basicElements;
+ }
};
}
@Override
- protected List<? extends TabField<?, ?, ? super WipTabElements, Params>> getTabFields() {
+ protected TabFieldList<? super WipTabElements, ? super Params> getTabFields() {
return WIP_TAB_FIELDS;
}
- private static final List<? extends TabField<?, ?, ? super WipTabElements, Params>>
+ private static final TabFieldList<? super WipTabElements, ? super Params>
WIP_TAB_FIELDS;
static {
- List<TabField<?, ?, ? super WipTabElements, Params>> list =
- new ArrayList<TabField<?, ?, ? super WipTabElements, Params>>(5);
-
- list.addAll(BASIC_TAB_FIELDS);
-
- list.add(new TabField<String, String, WipTabElements, Params>(
+ TabField<String, String, WipTabElements, Params> backendChooser =
+ new TabField<String, String, WipTabElements, Params>(
LaunchParams.WIP_BACKEND_ID, TypedMethods.STRING,
new FieldAccess<String, WipTabElements>() {
@Override void setValue(String value, WipTabElements tabElements) {
@@ -128,9 +114,20 @@ class WipRemoteTab extends ChromiumRemoteTab<WipRemoteTab.WipTabElements> {
return null;
}
},
- ValueConverter.<String>getTrivial()));
+ ValueConverter.<String>getTrivial());
+
+ List<TabFieldList<? super WipTabElements, ? super Params>> list =
+ new ArrayList<TabFieldList<? super WipTabElements, ? super Params>>(2);
+ list.add(createFieldListAdapting(BASIC_TAB_FIELDS,
+ new Adapter<WipTabElements, TabElements>() {
+ @Override
+ public TabElements get(WipTabElements from) {
+ return from.getBase();
+ }
+ }));
+ list.add(createFieldListImpl(Collections.singletonList(backendChooser)));
- WIP_TAB_FIELDS = Collections.unmodifiableList(list);
+ WIP_TAB_FIELDS = createCompositeFieldList(list);
}
private static final Params PARAMS = new Params(HostChecker.LOCAL_ONLY,
« no previous file with comments | « plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/TabBase.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698