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

Side by Side Diff: plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/ChromiumRemoteTab.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/ScriptMappingTab.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.debug.ui.launcher; 5 package org.chromium.debug.ui.launcher;
6 6
7 import java.util.ArrayList; 7 import java.util.ArrayList;
8 import java.util.Arrays; 8 import java.util.Arrays;
9 import java.util.Collection; 9 import java.util.Collection;
10 import java.util.Collections; 10 import java.util.Collections;
(...skipping 21 matching lines...) Expand all
32 import org.eclipse.debug.ui.DebugUITools; 32 import org.eclipse.debug.ui.DebugUITools;
33 import org.eclipse.debug.ui.IDebugUIConstants; 33 import org.eclipse.debug.ui.IDebugUIConstants;
34 import org.eclipse.jface.preference.BooleanFieldEditor; 34 import org.eclipse.jface.preference.BooleanFieldEditor;
35 import org.eclipse.jface.preference.FieldEditor; 35 import org.eclipse.jface.preference.FieldEditor;
36 import org.eclipse.jface.preference.IntegerFieldEditor; 36 import org.eclipse.jface.preference.IntegerFieldEditor;
37 import org.eclipse.jface.preference.PreferenceStore; 37 import org.eclipse.jface.preference.PreferenceStore;
38 import org.eclipse.jface.preference.StringFieldEditor; 38 import org.eclipse.jface.preference.StringFieldEditor;
39 import org.eclipse.jface.util.IPropertyChangeListener; 39 import org.eclipse.jface.util.IPropertyChangeListener;
40 import org.eclipse.jface.util.PropertyChangeEvent; 40 import org.eclipse.jface.util.PropertyChangeEvent;
41 import org.eclipse.swt.SWT; 41 import org.eclipse.swt.SWT;
42 import org.eclipse.swt.events.SelectionEvent;
43 import org.eclipse.swt.events.SelectionListener;
44 import org.eclipse.swt.graphics.Image; 42 import org.eclipse.swt.graphics.Image;
45 import org.eclipse.swt.layout.GridData; 43 import org.eclipse.swt.layout.GridData;
46 import org.eclipse.swt.layout.GridLayout; 44 import org.eclipse.swt.layout.GridLayout;
47 import org.eclipse.swt.widgets.Button; 45 import org.eclipse.swt.widgets.Button;
48 import org.eclipse.swt.widgets.Composite; 46 import org.eclipse.swt.widgets.Composite;
49 import org.eclipse.swt.widgets.Group; 47 import org.eclipse.swt.widgets.Group;
50 import org.eclipse.swt.widgets.Label;
51 48
52 /** 49 /**
53 * The "Remote" tab for the Chromium JavaScript launch tab group. 50 * The "Remote" tab for the Chromium JavaScript launch tab group.
54 * @param <ELEMENTS> type used for access to created dialog elements; it is used internally 51 * @param <ELEMENTS> type used for access to created dialog elements; it is used internally
55 * and allows to subclass {@link ChromiumRemoteTab} with additional dialog c ontrols 52 * and allows to subclass {@link ChromiumRemoteTab} with additional dialog c ontrols
56 */ 53 */
57 public abstract class ChromiumRemoteTab<ELEMENTS> extends TabBase<ELEMENTS, Para ms> { 54 public abstract class ChromiumRemoteTab<ELEMENTS> extends TabBase<ELEMENTS, Para ms> {
58 private static final String HOST_FIELD_NAME = "host_field"; //$NON-NLS-1$ 55 private static final String HOST_FIELD_NAME = "host_field"; //$NON-NLS-1$
59 private static final String PORT_FIELD_NAME = "port_field"; //$NON-NLS-1$ 56 private static final String PORT_FIELD_NAME = "port_field"; //$NON-NLS-1$
60 private static final String ADD_NETWORK_CONSOLE_FIELD_NAME = 57 private static final String ADD_NETWORK_CONSOLE_FIELD_NAME =
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return DebugUITools.getImage(IDebugUIConstants.IMG_LCL_DISCONNECT); 224 return DebugUITools.getImage(IDebugUIConstants.IMG_LCL_DISCONNECT);
228 } 225 }
229 226
230 interface TabElements { 227 interface TabElements {
231 StringFieldEditor getHost(); 228 StringFieldEditor getHost();
232 IntegerFieldEditor getPort(); 229 IntegerFieldEditor getPort();
233 BooleanFieldEditor getAddNetworkConsole(); 230 BooleanFieldEditor getAddNetworkConsole();
234 RadioButtonsLogic<Integer> getBreakpointRadioButtons(); 231 RadioButtonsLogic<Integer> getBreakpointRadioButtons();
235 } 232 }
236 233
237 protected abstract List<? extends TabField<?, ?, ? super ELEMENTS, Params>> ge tTabFields(); 234 static final TabFieldList<TabElements, Params> BASIC_TAB_FIELDS;
238
239 static final List<? extends TabField<?, ?, ? super TabElements, Params>> BASIC _TAB_FIELDS;
240 static { 235 static {
241 List<TabField<?, ?, ? super TabElements, Params>> list = 236 List<TabField<?, ?, ? super TabElements, Params>> list =
242 new ArrayList<ChromiumRemoteTab.TabField<?, ?, ? super TabElements, Para ms>>(4); 237 new ArrayList<ChromiumRemoteTab.TabField<?, ?, ? super TabElements, Para ms>>(4);
243 238
244 list.add(new TabField<String, String, TabElements, Params>( 239 list.add(new TabField<String, String, TabElements, Params>(
245 LaunchParams.CHROMIUM_DEBUG_HOST, TypedMethods.STRING, 240 LaunchParams.CHROMIUM_DEBUG_HOST, TypedMethods.STRING,
246 new FieldEditorAccess<String, TabElements>(TypedMethods.STRING) { 241 new FieldEditorAccess<String, TabElements>(TypedMethods.STRING) {
247 @Override 242 @Override
248 FieldEditor getFieldEditor(TabElements tabElements) { 243 FieldEditor getFieldEditor(TabElements tabElements) {
249 return tabElements.getHost(); 244 return tabElements.getHost();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 new DefaultsProvider<String, Params>() { 315 new DefaultsProvider<String, Params>() {
321 @Override String getFallbackValue() { 316 @Override String getFallbackValue() {
322 return Direction.MERGE.toString(); 317 return Direction.MERGE.toString();
323 } 318 }
324 @Override String getInitialConfigValue(Params context) { 319 @Override String getInitialConfigValue(Params context) {
325 return null; 320 return null;
326 } 321 }
327 }, 322 },
328 ValueConverter.<String>getTrivial())); 323 ValueConverter.<String>getTrivial()));
329 324
330 BASIC_TAB_FIELDS = Collections.unmodifiableList(list); 325 BASIC_TAB_FIELDS = createFieldListImpl(list);
331 } 326 }
332 327
333 private static class SourceContainerChecker { 328 private static class SourceContainerChecker {
334 public String check(ILaunchConfiguration config) { 329 public String check(ILaunchConfiguration config) {
335 LookupMode lookupMode; 330 LookupMode lookupMode;
336 try { 331 try {
337 lookupMode = ChromiumSourceDirector.readLookupMode(config); 332 lookupMode = ChromiumSourceDirector.readLookupMode(config);
338 } catch (CoreException e) { 333 } catch (CoreException e) {
339 ChromiumDebugPlugin.log(e); 334 ChromiumDebugPlugin.log(e);
340 return null; 335 return null;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 super(PARAMS); 381 super(PARAMS);
387 } 382 }
388 383
389 @Override 384 @Override
390 protected TabElements createDialogElements(Composite composite, 385 protected TabElements createDialogElements(Composite composite,
391 Runnable modifyListener, PreferenceStore store) { 386 Runnable modifyListener, PreferenceStore store) {
392 return createBasicTabElements(composite, modifyListener, store, getParams( )); 387 return createBasicTabElements(composite, modifyListener, store, getParams( ));
393 } 388 }
394 389
395 @Override 390 @Override
396 protected List<? extends TabField<?, ?, ? super TabElements, Params>> getTab Fields() { 391 protected TabFieldList<? super TabElements, ? super Params> getTabFields() {
397 return BASIC_TAB_FIELDS; 392 return BASIC_TAB_FIELDS;
398 } 393 }
399 394
400 private static final Params PARAMS = new Params( 395 private static final Params PARAMS = new Params(
401 ChromiumRemoteTab.HostChecker.LOCAL_ONLY, 396 ChromiumRemoteTab.HostChecker.LOCAL_ONLY,
402 Messages.ChromiumRemoteTab_URL, false); 397 Messages.ChromiumRemoteTab_URL, false);
403 } 398 }
404 399
405 static class Standalone extends ChromiumRemoteTab<TabElements> { 400 static class Standalone extends ChromiumRemoteTab<TabElements> {
406 public Standalone() { 401 public Standalone() {
407 super(PARAMS); 402 super(PARAMS);
408 } 403 }
409 404
410 @Override 405 @Override
411 protected TabElements createDialogElements(Composite composite, 406 protected TabElements createDialogElements(Composite composite,
412 Runnable modifyListener, PreferenceStore store) { 407 Runnable modifyListener, PreferenceStore store) {
413 return createBasicTabElements(composite, modifyListener, store, getParams( )); 408 return createBasicTabElements(composite, modifyListener, store, getParams( ));
414 } 409 }
415 410
416 @Override 411 @Override
417 protected List<? extends TabField<?, ?, ? super TabElements, Params>> getTab Fields() { 412 protected TabFieldList<? super TabElements, ? super Params> getTabFields() {
418 return BASIC_TAB_FIELDS; 413 return BASIC_TAB_FIELDS;
419 } 414 }
420 415
421 private static final Params PARAMS = new Params(null, 416 private static final Params PARAMS = new Params(null,
422 Messages.ChromiumRemoteTab_FILE_PATH, true); 417 Messages.ChromiumRemoteTab_FILE_PATH, true);
423 } 418 }
424 } 419 }
OLDNEW
« no previous file with comments | « no previous file | plugins/org.chromium.debug.ui/src/org/chromium/debug/ui/launcher/ScriptMappingTab.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698