Skip to content

Commit

Permalink
Restore CoreBuildMainTab
Browse files Browse the repository at this point in the history
* Restored class CoreBuildMainTab, because it is used by others.
  Created a new class CoreBuildMainTab2.
* Initialize CMainTab2.fDontCheckProgram.
  • Loading branch information
ewaterlander authored and jonahgraham committed Nov 27, 2024
1 parent 5639ba9 commit 9e9be4a
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

@Override
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);
}

/*
* 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 setDefaults(ILaunchConfigurationWorkingCopy configuration) {
// none
}

@Override
protected void createExeFileGroup(Composite parent, int colSpan) {
super.createExeFileGroup(parent, colSpan);
fProgText.setMessage(LaunchMessages.CoreBuildMainTab_Keep_empty_for_auto_selection);
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());
}
}

/*
* 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 performApply(ILaunchConfigurationWorkingCopy configuration) {
// TODO Auto-generated method stub

}

/*
* 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 String getName() {
return "Main";
}

}
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 9e9be4a

Please sign in to comment.