Lines 61-67
Link Here
|
61 |
import org.eclipse.swt.layout.GridData; |
61 |
import org.eclipse.swt.layout.GridData; |
62 |
import org.eclipse.swt.layout.GridLayout; |
62 |
import org.eclipse.swt.layout.GridLayout; |
63 |
import org.eclipse.swt.widgets.Button; |
63 |
import org.eclipse.swt.widgets.Button; |
64 |
import org.eclipse.swt.widgets.Combo; |
|
|
65 |
import org.eclipse.swt.widgets.Composite; |
64 |
import org.eclipse.swt.widgets.Composite; |
66 |
import org.eclipse.swt.widgets.Control; |
65 |
import org.eclipse.swt.widgets.Control; |
67 |
import org.eclipse.swt.widgets.FileDialog; |
66 |
import org.eclipse.swt.widgets.FileDialog; |
Lines 71-83
Link Here
|
71 |
import org.eclipse.ui.PlatformUI; |
70 |
import org.eclipse.ui.PlatformUI; |
72 |
import org.eclipse.ui.dialogs.ContainerSelectionDialog; |
71 |
import org.eclipse.ui.dialogs.ContainerSelectionDialog; |
73 |
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; |
72 |
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; |
74 |
import org.eclipse.ui.ide.IDEEncoding; |
|
|
75 |
import org.eclipse.ui.model.WorkbenchContentProvider; |
73 |
import org.eclipse.ui.model.WorkbenchContentProvider; |
76 |
import org.eclipse.ui.model.WorkbenchLabelProvider; |
74 |
import org.eclipse.ui.model.WorkbenchLabelProvider; |
77 |
import org.eclipse.ui.views.navigator.ResourceComparator; |
75 |
import org.eclipse.ui.views.navigator.ResourceComparator; |
78 |
|
76 |
|
79 |
import com.ibm.icu.text.MessageFormat; |
|
|
80 |
|
81 |
/** |
77 |
/** |
82 |
* Launch configuration tab used to specify the location a launch configuration |
78 |
* Launch configuration tab used to specify the location a launch configuration |
83 |
* is stored in, whether it should appear in the favorites list, and perspective |
79 |
* is stored in, whether it should appear in the favorites list, and perspective |
Lines 125-133
Link Here
|
125 |
private Text fSharedLocationText; |
121 |
private Text fSharedLocationText; |
126 |
private Button fSharedLocationButton; |
122 |
private Button fSharedLocationButton; |
127 |
private Button fLaunchInBackgroundButton; |
123 |
private Button fLaunchInBackgroundButton; |
128 |
private Button fDefaultEncodingButton; |
|
|
129 |
private Button fAltEncodingButton; |
130 |
private Combo fEncodingCombo; |
131 |
private Button fConsoleOutput; |
124 |
private Button fConsoleOutput; |
132 |
private Button fFileOutput; |
125 |
private Button fFileOutput; |
133 |
private Button fFileBrowse; |
126 |
private Button fFileBrowse; |
Lines 135-140
Link Here
|
135 |
private Button fVariables; |
128 |
private Button fVariables; |
136 |
private Button fAppend; |
129 |
private Button fAppend; |
137 |
private Button fWorkspaceBrowse; |
130 |
private Button fWorkspaceBrowse; |
|
|
131 |
private ConsoleEncodingEditor fEncodingEditor; |
138 |
|
132 |
|
139 |
/** |
133 |
/** |
140 |
* Check box list for specifying favorites |
134 |
* Check box list for specifying favorites |
Lines 358-404
Link Here
|
358 |
* @param parent the parent to add this composite to |
352 |
* @param parent the parent to add this composite to |
359 |
*/ |
353 |
*/ |
360 |
private void createEncodingComponent(Composite parent) { |
354 |
private void createEncodingComponent(Composite parent) { |
361 |
Group group = SWTFactory.createGroup(parent, LaunchConfigurationsMessages.CommonTab_1, 2, 1, GridData.FILL_BOTH); |
355 |
Composite composite = new Composite(parent, SWT.NONE); |
362 |
|
356 |
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
363 |
fDefaultEncodingButton = createRadioButton(group, IInternalDebugCoreConstants.EMPTY_STRING); |
357 |
fEncodingEditor = new ConsoleEncodingEditor(composite, this); |
364 |
GridData gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false); |
|
|
365 |
gd.horizontalSpan = 2; |
366 |
fDefaultEncodingButton.setLayoutData(gd); |
367 |
|
368 |
fAltEncodingButton = createRadioButton(group, LaunchConfigurationsMessages.CommonTab_3); |
369 |
fAltEncodingButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); |
370 |
|
371 |
fEncodingCombo = new Combo(group, SWT.READ_ONLY); |
372 |
fEncodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
373 |
fEncodingCombo.setFont(parent.getFont()); |
374 |
List allEncodings = IDEEncoding.getIDEEncodings(); |
375 |
String[] encodingArray = (String[]) allEncodings.toArray(new String[0]); |
376 |
fEncodingCombo.setItems(encodingArray); |
377 |
if (encodingArray.length > 0) { |
378 |
fEncodingCombo.select(0); |
379 |
} |
380 |
fEncodingCombo.getAccessible().addAccessibleListener(new AccessibleAdapter() { |
381 |
public void getName(AccessibleEvent e) { |
382 |
e.result = LaunchConfigurationsMessages.CommonTab_3; |
383 |
} |
384 |
}); |
385 |
SelectionListener listener = new SelectionAdapter() { |
386 |
public void widgetSelected(SelectionEvent e) { |
387 |
if(e.getSource() instanceof Button) { |
388 |
Button button = (Button)e.getSource(); |
389 |
if(button.getSelection()) { |
390 |
updateLaunchConfigurationDialog(); |
391 |
fEncodingCombo.setEnabled(fAltEncodingButton.getSelection() == true); |
392 |
} |
393 |
} |
394 |
else { |
395 |
updateLaunchConfigurationDialog(); |
396 |
} |
397 |
} |
398 |
}; |
399 |
fAltEncodingButton.addSelectionListener(listener); |
400 |
fDefaultEncodingButton.addSelectionListener(listener); |
401 |
fEncodingCombo.addSelectionListener(listener); |
402 |
} |
358 |
} |
403 |
|
359 |
|
404 |
/** |
360 |
/** |
Lines 558-581
Link Here
|
558 |
* @param configuration the local configuration |
514 |
* @param configuration the local configuration |
559 |
*/ |
515 |
*/ |
560 |
private void updateEncoding(ILaunchConfiguration configuration) { |
516 |
private void updateEncoding(ILaunchConfiguration configuration) { |
|
|
517 |
fEncodingEditor.setDefaultEncoding(getDefaultEncoding(configuration)); |
561 |
String encoding = null; |
518 |
String encoding = null; |
562 |
try { |
519 |
try { |
563 |
encoding = configuration.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null); |
520 |
encoding = configuration.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null); |
564 |
} catch (CoreException e) { |
521 |
} catch (CoreException e) { |
565 |
} |
522 |
} |
566 |
String defaultEncoding = getDefaultEncoding(configuration); |
523 |
fEncodingEditor.setEncoding(encoding); |
567 |
fDefaultEncodingButton.setText(MessageFormat.format(LaunchConfigurationsMessages.CommonTab_2, new String[]{defaultEncoding})); |
524 |
fEncodingEditor.load(); |
568 |
fDefaultEncodingButton.pack(); |
|
|
569 |
if (encoding != null) { |
570 |
fAltEncodingButton.setSelection(true); |
571 |
fDefaultEncodingButton.setSelection(false); |
572 |
fEncodingCombo.setText(encoding); |
573 |
fEncodingCombo.setEnabled(true); |
574 |
} else { |
575 |
fDefaultEncodingButton.setSelection(true); |
576 |
fAltEncodingButton.setSelection(false); |
577 |
fEncodingCombo.setEnabled(false); |
578 |
} |
579 |
} |
525 |
} |
580 |
|
526 |
|
581 |
/** |
527 |
/** |
Lines 724-747
Link Here
|
724 |
setMessage(null); |
670 |
setMessage(null); |
725 |
setErrorMessage(null); |
671 |
setErrorMessage(null); |
726 |
|
672 |
|
727 |
return validateLocalShared() && validateRedirectFile() && validateEncoding(); |
673 |
return validateLocalShared() && validateRedirectFile() && fEncodingEditor.validateEncoding(); |
728 |
} |
674 |
} |
729 |
|
675 |
|
730 |
/** |
676 |
/** |
731 |
* validates the encoding selection |
|
|
732 |
* @return true if the validate encoding is allowable, false otherwise |
733 |
*/ |
734 |
private boolean validateEncoding() { |
735 |
if (fAltEncodingButton.getSelection()) { |
736 |
if (fEncodingCombo.getSelectionIndex() == -1) { |
737 |
setErrorMessage(LaunchConfigurationsMessages.CommonTab_No_Encoding_Selected); |
738 |
return false; |
739 |
} |
740 |
} |
741 |
return true; |
742 |
} |
743 |
|
744 |
/** |
745 |
* Validates if the redirect file is valid |
677 |
* Validates if the redirect file is valid |
746 |
* @return true if the filename is not zero, false otherwise |
678 |
* @return true if the filename is not zero, false otherwise |
747 |
*/ |
679 |
*/ |
Lines 790-800
Link Here
|
790 |
updateConfigFromLocalShared(configuration); |
722 |
updateConfigFromLocalShared(configuration); |
791 |
updateConfigFromFavorites(configuration); |
723 |
updateConfigFromFavorites(configuration); |
792 |
setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, configuration, fLaunchInBackgroundButton.getSelection(), true); |
724 |
setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, configuration, fLaunchInBackgroundButton.getSelection(), true); |
793 |
String encoding = null; |
725 |
configuration.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, fEncodingEditor.getEncoding()); |
794 |
if(fAltEncodingButton.getSelection()) { |
|
|
795 |
encoding = fEncodingCombo.getText(); |
796 |
} |
797 |
configuration.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, encoding); |
798 |
boolean captureOutput = false; |
726 |
boolean captureOutput = false; |
799 |
if (fConsoleOutput.getSelection()) { |
727 |
if (fConsoleOutput.getSelection()) { |
800 |
captureOutput = true; |
728 |
captureOutput = true; |
Lines 842-848
Link Here
|
842 |
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#canSave() |
770 |
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#canSave() |
843 |
*/ |
771 |
*/ |
844 |
public boolean canSave() { |
772 |
public boolean canSave() { |
845 |
return validateLocalShared(); |
773 |
return validateLocalShared() && fEncodingEditor.validateEncoding(); |
846 |
} |
774 |
} |
847 |
|
775 |
|
848 |
/* (non-Javadoc) |
776 |
/* (non-Javadoc) |