1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Restore CoreBuildMainTab
Some checks failed
Build and Test / build (push) Has been cancelled
Code Cleanliness Checks / build (push) Has been cancelled
License vetting status check / call-license-check (push) Has been cancelled

* Restored class CoreBuildMainTab, because it is used by others.
  Created a new class CoreBuildMainTab2.
* Initialize CMainTab2.fDontCheckProgram.
This commit is contained in:
Erwin Waterlander 2024-11-26 12:41:27 +00:00 committed by Jonah Graham
parent 5639ba9ff9
commit 9e9be4a5e2
4 changed files with 114 additions and 32 deletions

View file

@ -11,7 +11,7 @@
package org.eclipse.cdt.launch.internal.corebuild;
import org.eclipse.cdt.launch.ui.CArgumentsTab;
import org.eclipse.cdt.launch.ui.corebuild.CoreBuildMainTab;
import org.eclipse.cdt.launch.ui.corebuild.CoreBuildMainTab2;
import org.eclipse.cdt.launch.ui.corebuild.CoreBuildTab;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.EnvironmentTab;
@ -22,7 +22,7 @@ public class LocalLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab mainTab = new CoreBuildMainTab();
ILaunchConfigurationTab mainTab = new CoreBuildMainTab2();
ILaunchConfigurationTab buildTab = new CoreBuildTab();
ILaunchConfigurationTab argumentsTab = new CArgumentsTab();
ILaunchConfigurationTab environmentTab = new EnvironmentTab();

View file

@ -93,7 +93,7 @@ public class CMainTab2 extends CAbstractMainTab {
*/
protected Combo fCoreTypeCombo;
private boolean fDontCheckProgram;
private boolean fDontCheckProgram = false;
private final boolean fSpecifyCoreFile;
private final boolean fIncludeBuildSettings;

View file

@ -10,51 +10,73 @@
*******************************************************************************/
package org.eclipse.cdt.launch.ui.corebuild;
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.ui.CMainTab2;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
* @since 9.1
*/
public class CoreBuildMainTab extends CMainTab2 {
public class CoreBuildMainTab extends AbstractLaunchConfigurationTab {
private Text projectName;
/*
* A Core Build launch configuration is created immediately upon the Core Build project creation.
* It cannot be created by hand and it is not duplicatable and can't be renamed.
* The launch configuration is tied to the project. The project name may not be changed.
*/
@Override
protected void createProjectGroup(Composite parent, int colSpan) {
super.createProjectGroup(parent, colSpan);
fProjText.setEnabled(false);
fProjButton.setVisible(false);
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
Label label = new Label(comp, SWT.NONE);
label.setText("This launch configuration was automatically created.");
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
label = new Label(comp, SWT.NONE);
label.setText("Project:");
projectName = new Text(comp, SWT.READ_ONLY | SWT.BORDER);
projectName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
setControl(comp);
}
@Override
protected void createExeFileGroup(Composite parent, int colSpan) {
super.createExeFileGroup(parent, colSpan);
fProgText.setMessage(LaunchMessages.CoreBuildMainTab_Keep_empty_for_auto_selection);
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
// none
}
/*
* For Core Build projects the build configuration is hidden and it is selected
* via the LaunchBar Launch Mode. We remove the BuildConfigCombo.
*/
@Override
protected void createBuildConfigCombo(Composite parent, int colspan) {
fBuildConfigCombo = null;
public void initializeFrom(ILaunchConfiguration configuration) {
try {
for (IResource resource : configuration.getMappedResources()) {
if (resource instanceof IProject) {
projectName.setText(resource.getName());
break;
}
}
} catch (CoreException e) {
LaunchUIPlugin.log(e.getStatus());
}
}
/*
* Don't check the program name if it is empty. When the program name is empty the default
* CoreBuild binary is used.
*/
@Override
public boolean isValid(ILaunchConfiguration config) {
String programName = fProgText.getText().trim();
setDontCheckProgram(programName.isEmpty());
return super.isValid(config);
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
// TODO Auto-generated method stub
}
@Override
public String getName() {
return "Main";
}
}

View file

@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright (c) 2024 Intel corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.cdt.launch.ui.corebuild;
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.ui.CMainTab2;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.swt.widgets.Composite;
/**
* @since 10.4
*/
public class CoreBuildMainTab2 extends CMainTab2 {
/*
* A Core Build launch configuration is created immediately upon the Core Build project creation.
* It cannot be created by hand and it is not duplicatable and can't be renamed.
* The launch configuration is tied to the project. The project name may not be changed.
*/
@Override
protected void createProjectGroup(Composite parent, int colSpan) {
super.createProjectGroup(parent, colSpan);
fProjText.setEnabled(false);
fProjButton.setVisible(false);
}
@Override
protected void createExeFileGroup(Composite parent, int colSpan) {
super.createExeFileGroup(parent, colSpan);
fProgText.setMessage(LaunchMessages.CoreBuildMainTab_Keep_empty_for_auto_selection);
}
/*
* For Core Build projects the build configuration is hidden and it is selected
* via the LaunchBar Launch Mode. We remove the BuildConfigCombo.
*/
@Override
protected void createBuildConfigCombo(Composite parent, int colspan) {
fBuildConfigCombo = null;
}
/*
* Don't check the program name if it is empty. When the program name is empty the default
* CoreBuild binary is used.
*/
@Override
public boolean isValid(ILaunchConfiguration config) {
String programName = fProgText.getText().trim();
setDontCheckProgram(programName.isEmpty());
return super.isValid(config);
}
}