Skip to content

Commit bbbb45e

Browse files
authored
Merge branch 'eclipse-platform:master' into master
2 parents f457947 + a02997e commit bbbb45e

22 files changed

+191
-93
lines changed

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public class LaunchConfigurationsMessages extends NLS {
4848
public static String CommonTab_20;
4949
public static String CommonTab_21;
5050
public static String CommonTab_22;
51+
52+
public static String CommonTab_23;
53+
54+
public static String CommonTab_24;
5155
public static String CommonTab_3;
5256
public static String CommonTab_4;
5357
public static String CommonTab_5;
@@ -66,6 +70,8 @@ public class LaunchConfigurationsMessages extends NLS {
6670
public static String CommonTab_AttributeLabel_FavoriteGroups;
6771
public static String CommonTab_AttributeLabel_TerminateDescendants;
6872

73+
public static String CommonTab_disable_console_input;
74+
6975
public static String CompileErrorProjectPromptStatusHandler_0;
7076
public static String CompileErrorProjectPromptStatusHandler_1;
7177
public static String CompileErrorPromptStatusHandler_0;

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ CommonTab_2=Defa&ult - inherited from project and workspace ({0})
4141
CommonTab_22=Use &system encoding ({0})
4242
CommonTab_20=Variables...
4343
CommonTab_21=&Merge standard and error output (disables coloring of error output)
44+
CommonTab_23=Allocate Terminal
45+
CommonTab_24=&Allocate text console
4446
CommonTab_3=Oth&er
4547
CommonTab_4=Standard Input and Output
4648
CommonTab_5=&Allocate console (necessary for input)
@@ -57,6 +59,7 @@ CommonTab_AttributeLabel_AppendToFile=Append to file
5759
CommonTab_AttributeLabel_LaunchInBackground=Launch in background
5860
CommonTab_AttributeLabel_FavoriteGroups=Favorite groups
5961
CommonTab_AttributeLabel_TerminateDescendants=&Terminate child-processes if terminating the launched process
62+
CommonTab_disable_console_input=Disable Input/Output
6063

6164
CompileErrorPromptStatusHandler_0=Errors in Workspace
6265
CompileErrorPromptStatusHandler_1=Errors exist in a required project. Continue launch?

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java

Lines changed: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import org.eclipse.core.resources.IWorkspaceRoot;
3434
import org.eclipse.core.resources.ResourcesPlugin;
3535
import org.eclipse.core.runtime.CoreException;
36+
import org.eclipse.core.runtime.IConfigurationElement;
37+
import org.eclipse.core.runtime.IExtensionPoint;
3638
import org.eclipse.core.runtime.IPath;
3739
import org.eclipse.core.runtime.IStatus;
3840
import org.eclipse.core.runtime.Platform;
@@ -98,6 +100,7 @@
98100
*/
99101
public class CommonTab extends AbstractLaunchConfigurationTab {
100102

103+
private static final String TERMINAL_PROCESS_FACTORY_ID = "org.eclipse.debug.terminal.processFactory"; //$NON-NLS-1$
101104
/**
102105
* Constant representing the id of the {@link IDialogSettings} location for the {@link ContainerSelectionDialog} used
103106
* on this tab
@@ -130,6 +133,8 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
130133
private Button forceSystemEncodingButton;
131134
private Combo fEncodingCombo;
132135
private Button fConsoleOutput;
136+
private Button noConsoleOutput;
137+
private Button terminalOutput;
133138
private Button fFileOutput;
134139
private Button fFileBrowse;
135140
private Text fFileText;
@@ -153,13 +158,15 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
153158
* Modify listener that simply updates the owning launch configuration dialog.
154159
*/
155160
private final ModifyListener fBasicModifyListener = evt -> scheduleUpdateJob();
161+
private boolean hasTerminalSupport;
156162

157163
/**
158164
* Constructs a new tab with default context help.
159165
*/
160166
public CommonTab() {
161167
super();
162168
setHelpContextId(IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_COMMON_TAB);
169+
hasTerminalSupport = hasTerminalSupport();
163170
}
164171

165172
@Override
@@ -311,8 +318,22 @@ private void createOutputCaptureComponent(Composite parent) {
311318

312319
private void createInputCaptureComponent(Composite parent){
313320
Composite comp1 = SWTFactory.createComposite(parent, parent.getFont(), 5, 5, GridData.FILL_BOTH, 0, 0);
314-
fConsoleOutput = createCheckButton(comp1, LaunchConfigurationsMessages.CommonTab_5);
315-
fConsoleOutput.addSelectionListener(widgetSelectedAdapter(e -> updateLaunchConfigurationDialog()));
321+
if (hasTerminalSupport) {
322+
SelectionListener adapter = widgetSelectedAdapter(e -> updateLaunchConfigurationDialog());
323+
Composite buttonComposite = new Composite(comp1, SWT.NONE);
324+
buttonComposite.setLayout(new GridLayout(3, false));
325+
fConsoleOutput = createRadioButton(buttonComposite, LaunchConfigurationsMessages.CommonTab_24);
326+
fConsoleOutput.addSelectionListener(adapter);
327+
terminalOutput = createRadioButton(buttonComposite, LaunchConfigurationsMessages.CommonTab_23);
328+
terminalOutput.addSelectionListener(adapter);
329+
noConsoleOutput = createRadioButton(buttonComposite,
330+
LaunchConfigurationsMessages.CommonTab_disable_console_input);
331+
noConsoleOutput.addSelectionListener(adapter);
332+
333+
} else {
334+
fConsoleOutput = createCheckButton(comp1, LaunchConfigurationsMessages.CommonTab_5);
335+
fConsoleOutput.addSelectionListener(widgetSelectedAdapter(e -> updateLaunchConfigurationDialog()));
336+
}
316337

317338
Composite comp = SWTFactory.createComposite(comp1, comp1.getFont(), 5, 5, GridData.FILL_BOTH, 0, 0);
318339
fInputFileCheckButton = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_17);
@@ -388,6 +409,20 @@ private void createInputCaptureComponent(Composite parent){
388409

389410
setInputFileEnabled(false);
390411
}
412+
413+
private static boolean hasTerminalSupport() {
414+
IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
415+
.getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_PROCESS_FACTORIES);
416+
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
417+
for (IConfigurationElement configurationElement : infos) {
418+
String id = configurationElement.getAttribute("id"); //$NON-NLS-1$
419+
if (TERMINAL_PROCESS_FACTORY_ID.equals(id)) {
420+
return true;
421+
}
422+
}
423+
return false;
424+
}
425+
391426
/**
392427
* Enables or disables the output capture widgets based on the the specified enablement
393428
* @param enable if the output capture widgets should be enabled or not
@@ -665,8 +700,20 @@ private void updateConsoleOutput(ILaunchConfiguration configuration) {
665700
supportsMergeOutput = configuration.getType().supportsOutputMerging();
666701
} catch (CoreException e) {
667702
}
668-
669-
fConsoleOutput.setSelection(outputToConsole);
703+
if (hasTerminalSupport) {
704+
if (outputToConsole) {
705+
if (TERMINAL_PROCESS_FACTORY_ID
706+
.equals(getAttribute(configuration, DebugPlugin.ATTR_PROCESS_FACTORY_ID, ""))) { //$NON-NLS-1$
707+
terminalOutput.setSelection(true);
708+
} else {
709+
fConsoleOutput.setSelection(true);
710+
}
711+
} else {
712+
noConsoleOutput.setSelection(true);
713+
}
714+
} else {
715+
fConsoleOutput.setSelection(outputToConsole);
716+
}
670717
fAppend.setSelection(append);
671718
if (supportsMergeOutput) {
672719
fMergeOutput = createCheckButton(fIoComposit, LaunchConfigurationsMessages.CommonTab_21);
@@ -994,11 +1041,25 @@ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
9941041
}
9951042
configuration.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, encoding);
9961043
boolean captureOutput = false;
997-
if (fConsoleOutput.getSelection()) {
998-
captureOutput = true;
999-
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, (String) null);
1044+
if (hasTerminalSupport) {
1045+
if (noConsoleOutput.getSelection()) {
1046+
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
1047+
} else {
1048+
captureOutput = true;
1049+
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, (String) null);
1050+
if (terminalOutput.getSelection()) {
1051+
configuration.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID, TERMINAL_PROCESS_FACTORY_ID);
1052+
} else {
1053+
configuration.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID, (String) null);
1054+
}
1055+
}
10001056
} else {
1001-
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
1057+
if (fConsoleOutput.getSelection()) {
1058+
captureOutput = true;
1059+
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, (String) null);
1060+
} else {
1061+
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
1062+
}
10021063
}
10031064
if (fInputFileCheckButton.getSelection()) {
10041065
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, fInputFileLocationText.getText());

ua/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,29 +83,33 @@ public static TocManager getTocManager() {
8383
* Used to obtain Context Manager returns an instance of ContextManager
8484
*/
8585
public static ContextManager getContextManager() {
86-
if (getDefault().contextManager == null)
86+
if (getDefault().contextManager == null) {
8787
getDefault().contextManager = new ContextManager();
88+
}
8889
return getDefault().contextManager;
8990
}
9091

9192
/**
9293
* Used to obtain the ContentExtensionManager
9394
*/
9495
public static ContentExtensionManager getContentExtensionManager() {
95-
if (getDefault().contentExtensionManager == null)
96+
if (getDefault().contentExtensionManager == null) {
9697
getDefault().contentExtensionManager = new ContentExtensionManager();
98+
}
9799
return getDefault().contentExtensionManager;
98100
}
99101

100102
public static IndexManager getIndexManager() {
101-
if (getDefault().indexManager == null)
103+
if (getDefault().indexManager == null) {
102104
getDefault().indexManager = new IndexManager();
105+
}
103106
return getDefault().indexManager;
104107
}
105108

106109
public static CriteriaManager getCriteriaManager() {
107-
if (getDefault().criteriaManager == null)
110+
if (getDefault().criteriaManager == null) {
108111
getDefault().criteriaManager = new CriteriaManager();
112+
}
109113
return getDefault().criteriaManager;
110114
}
111115

ua/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,13 @@ private Map<String, Context> loadContextsFromInputStream(ContextFile descriptor,
234234
IUAElement[] children = root.getChildren();
235235
Map<String, Context> contexts = new HashMap<>();
236236
for (int i=0;i<children.length;++i) {
237-
if (children[i] instanceof Context) {
238-
Context context = (Context)children[i];
237+
if (children[i] instanceof Context context) {
239238
String id = context.getId();
240239
if (id != null) {
241240
Object existingContext = contexts.get(id);
242-
if (existingContext==null)
241+
if (existingContext==null) {
243242
contexts.put(id, context);
244-
else
243+
} else
245244
{
246245
((Context)existingContext).mergeContext(context);
247246

@@ -290,8 +289,7 @@ private Map<String, String[]> getRequiredAttributes() {
290289
private class NormalizeHandler extends ProcessorHandler {
291290
@Override
292291
public short handle(UAElement element, String id) {
293-
if (element instanceof Context) {
294-
Context context = (Context)element;
292+
if (element instanceof Context context) {
295293
IUAElement[] children = context.getChildren();
296294
if (children.length > 0 && Context.ELEMENT_DESCRIPTION.equals(((UAElement)children[0]).getElementName())) {
297295
StringBuilder buf = new StringBuilder();
@@ -321,8 +319,7 @@ else if (node.getNodeType() == Node.ELEMENT_NODE) {
321319
description.appendChild(document.createTextNode(buf.toString()));
322320
}
323321
}
324-
else if (element instanceof Topic) {
325-
Topic topic = (Topic)element;
322+
else if (element instanceof Topic topic) {
326323
String href = topic.getHref();
327324
if (href != null) {
328325
int index = id.indexOf('/', 1);

ua/org.eclipse.help/src/org/eclipse/help/internal/context/ContextManager.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ public class ContextManager {
4545

4646
public ContextManager()
4747
{
48-
if (HelpPlugin.DEBUG_CONTEXT)
48+
if (HelpPlugin.DEBUG_CONTEXT) {
4949
checkContextProviders();
50+
}
5051
}
5152

5253
/*
@@ -88,8 +89,9 @@ public IContext getContext(String contextId, String locale) {
8889

8990
String id = contextId;
9091
ArrayList<String> potentialMatches = new ArrayList<>();
91-
if ((index = contextId.lastIndexOf('.'))>-1)
92+
if ((index = contextId.lastIndexOf('.'))>-1) {
9293
id = contextId.substring(index+1);
94+
}
9395

9496
String warning = "Registered Context Provider IDs:\n"; //$NON-NLS-1$
9597
Iterator<String> iter = contextIDsByPluginId.keySet().iterator();
@@ -109,8 +111,9 @@ public IContext getContext(String contextId, String locale) {
109111
warning+="--------------------------------"; //$NON-NLS-1$
110112
System.out.println(warning);
111113

112-
if (!potentialMatches.isEmpty())
114+
if (!potentialMatches.isEmpty()) {
113115
System.out.println("The ID searched is "+contextId+". Did you mean to call setHelp with:\n"+potentialMatches); //$NON-NLS-1$ //$NON-NLS-2$
116+
}
114117
}
115118

116119
return null;

ua/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFile.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ public String getPluginId() {
4444
}
4545

4646
public InputStream getInputStream() throws IOException {
47-
if (pluginId != null)
47+
if (pluginId != null) {
4848
return ResourceLocator.openFromPlugin(pluginId, file, locale);
49-
else
49+
} else {
5050
return new FileInputStream(file);
51+
}
5152
}
5253
}

ua/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ public ICriteriaDefinitionContribution[] getCriteriaDefinitionContributions(Stri
5757

5858
// Use the contained exception.
5959
Exception x = spe;
60-
if (spe.getException() != null)
60+
if (spe.getException() != null) {
6161
x = spe.getException();
62+
}
6263
ILog.of(getClass()).error(buffer.toString(), x);
6364

6465
}

ua/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ public void addCriteriaValues(ICriteria[] criteria, String locale){
8181
List<String> criterionValues = criterion.getCriterionValues();
8282

8383
Set<String> existedValues = criteriaInLocale.get(criterionName);
84-
if (null == existedValues)
84+
if (null == existedValues) {
8585
existedValues = new HashSet<>();
86+
}
8687
existedValues.addAll(criterionValues);
8788
criteriaInLocale.put(criterionName, existedValues);
8889
}

ua/org.eclipse.help/src/org/eclipse/help/internal/index/Index.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public IIndexEntry[] getEntries() {
5050
* @return the entry with matching keyword or null
5151
*/
5252
public IndexEntry getSeeTarget(IndexSee see) {
53-
if (children == null) getChildren();
53+
if (children == null) {
54+
getChildren();
55+
}
5456
String keyword = see.getKeyword();
5557
for (Iterator<UAElement> iter = children.iterator(); iter.hasNext();) {
5658
UAElement next = iter.next();

0 commit comments

Comments
 (0)