mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 16:05:25 +02:00
External code commit from Leo Treggiari from Intel that adds support for adding and removing error psarser on a managed build project
This commit is contained in:
parent
4528b2a06c
commit
ae1b577d72
11 changed files with 402 additions and 22 deletions
|
@ -9,6 +9,7 @@ MngCCWizard.description=Create a new C++ project and let Eclipse create and mana
|
||||||
|
|
||||||
#The property pages
|
#The property pages
|
||||||
MngBuildProp.name=C/C++ Build
|
MngBuildProp.name=C/C++ Build
|
||||||
|
MngOtherProp.name= Error Parsers
|
||||||
|
|
||||||
# Build Model Names
|
# Build Model Names
|
||||||
TargetName.cygw=Cygwin
|
TargetName.cygw=Cygwin
|
||||||
|
|
|
@ -65,6 +65,20 @@
|
||||||
</filter>
|
</filter>
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.ui.propertyPages">
|
||||||
|
<page
|
||||||
|
objectClass="org.eclipse.core.resources.IProject"
|
||||||
|
adaptable="true"
|
||||||
|
name="%MngOtherProp.name"
|
||||||
|
class="org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderPropertyPage"
|
||||||
|
id="org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderProperties">
|
||||||
|
<filter
|
||||||
|
name="nature"
|
||||||
|
value="org.eclipse.cdt.managedbuilder.core.managedBuildNature">
|
||||||
|
</filter>
|
||||||
|
</page>
|
||||||
|
</extension>
|
||||||
<!-- Managed Make Builder Tool Specifications -->
|
<!-- Managed Make Builder Tool Specifications -->
|
||||||
<extension
|
<extension
|
||||||
id="cdt.managed.build.info"
|
id="cdt.managed.build.info"
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v0.5
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v05.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX Software Systems - Move to Make plugin
|
||||||
|
* Intel Corp - Use in Managed Make system
|
||||||
|
***********************************************************************/
|
||||||
|
package org.eclipse.cdt.managedbuilder.internal.ui;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
import org.eclipse.cdt.managedbuilder.ui.wizards.NewManagedProjectOptionPage;
|
||||||
|
import org.eclipse.cdt.managedbuilder.ui.wizards.NewManagedProjectWizard;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
|
public class ErrorParserBlock extends AbstractErrorParserBlock {
|
||||||
|
|
||||||
|
public ErrorParserBlock() {
|
||||||
|
super(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] getErrorParserIDs(ITarget target) {
|
||||||
|
// Get the list of error parsers specified with this Target
|
||||||
|
String[] errorParsers = target.getErrorParserList();
|
||||||
|
if (errorParsers != null) {
|
||||||
|
return errorParsers;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If no error parsers are specified by the target, the default is
|
||||||
|
// all error parsers
|
||||||
|
return CCorePlugin.getDefault().getAllErrorParsersIDs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] getErrorParserIDs(IProject project) {
|
||||||
|
ITarget target = ManagedBuildManager.getSelectedTarget(project);
|
||||||
|
if (target == null) {
|
||||||
|
// This case occurs when modifying the properties of an existing
|
||||||
|
// managed build project, and the user selects the error parsers
|
||||||
|
// page before the "C/C++ Build" page.
|
||||||
|
|
||||||
|
// Get the build information
|
||||||
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project, true);
|
||||||
|
target = info.getDefaultTarget();
|
||||||
|
}
|
||||||
|
if (target != null) {
|
||||||
|
return getErrorParserIDs(target);
|
||||||
|
} else {
|
||||||
|
return CCorePlugin.getDefault().getAllErrorParsersIDs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] getErrorParserIDs() {
|
||||||
|
// Get the currently selected target from the page's container
|
||||||
|
// This is invoked by the managed builder new project wizard before the
|
||||||
|
// project is created.
|
||||||
|
ICOptionContainer container = getContainer();
|
||||||
|
if (container instanceof NewManagedProjectOptionPage) {
|
||||||
|
NewManagedProjectOptionPage parent = (NewManagedProjectOptionPage)getContainer();
|
||||||
|
NewManagedProjectWizard wizard = (NewManagedProjectWizard)parent.getWizard();
|
||||||
|
ITarget target = wizard.getSelectedTarget();
|
||||||
|
return getErrorParserIDs(target);
|
||||||
|
}
|
||||||
|
return CCorePlugin.getDefault().getAllErrorParsersIDs();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveErrorParsers(IProject project, String[] parsers) {
|
||||||
|
ITarget target = ManagedBuildManager.getSelectedTarget(project);
|
||||||
|
if (target != null) {
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
for (int i = 0; i < parsers.length; i++) {
|
||||||
|
if (i > 0) buf.append(';');
|
||||||
|
buf.append(parsers[i]);
|
||||||
|
}
|
||||||
|
target.setErrorParserIds(buf.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,11 +12,18 @@ package org.eclipse.cdt.managedbuilder.internal.ui;
|
||||||
* **********************************************************************/
|
* **********************************************************************/
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.IPluginDescriptor;
|
import org.eclipse.core.runtime.IPluginDescriptor;
|
||||||
import org.eclipse.core.runtime.Plugin;
|
import org.eclipse.core.runtime.Plugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
|
||||||
public class ManagedBuilderUIPlugin extends Plugin {
|
public class ManagedBuilderUIPlugin extends Plugin {
|
||||||
|
@ -76,4 +83,38 @@ public class ManagedBuilderUIPlugin extends Plugin {
|
||||||
return getDefault().getDescriptor().getUniqueIdentifier();
|
return getDefault().getDescriptor().getUniqueIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void log(IStatus status) {
|
||||||
|
ResourcesPlugin.getPlugin().getLog().log(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void log(Throwable e) {
|
||||||
|
if (e instanceof InvocationTargetException)
|
||||||
|
e = ((InvocationTargetException) e).getTargetException();
|
||||||
|
IStatus status = null;
|
||||||
|
if (e instanceof CoreException)
|
||||||
|
status = ((CoreException) e).getStatus();
|
||||||
|
else
|
||||||
|
status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, e.getMessage(), e);
|
||||||
|
log(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method with conventions
|
||||||
|
*/
|
||||||
|
public static void errorDialog(Shell shell, String title, String message, Throwable t) {
|
||||||
|
log(t);
|
||||||
|
IStatus status;
|
||||||
|
if (t instanceof CoreException) {
|
||||||
|
status = ((CoreException) t).getStatus();
|
||||||
|
// if the 'message' resource string and the IStatus' message are the same,
|
||||||
|
// don't show both in the dialog
|
||||||
|
if (status != null && message.equals(status.getMessage())) {
|
||||||
|
message = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
status = new Status(IStatus.ERROR, ManagedBuilderUIPlugin.getUniqueIdentifier(), -1, "Internal Error: ", t); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
ErrorDialog.openError(shell, title, message, status);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,20 +16,25 @@ import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
||||||
|
|
||||||
public class ManagedProjectOptionBlock extends TabFolderOptionBlock {
|
public class ManagedProjectOptionBlock extends TabFolderOptionBlock {
|
||||||
|
|
||||||
|
ErrorParserBlock errParserBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
public ManagedProjectOptionBlock(ICOptionContainer parent) {
|
public ManagedProjectOptionBlock(ICOptionContainer parent) {
|
||||||
super(parent);
|
super(parent);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock#addTabs()
|
* @see org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock#addTabs()
|
||||||
*/
|
*/
|
||||||
protected void addTabs() {
|
protected void addTabs() {
|
||||||
// TODO Auto-generated method stub
|
errParserBlock = new ErrorParserBlock();
|
||||||
|
addTab(errParserBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ErrorParserBlock getErrorParserBlock() {
|
||||||
|
return errParserBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,5 +113,6 @@ FileListControl.deletedialog.title=Confirm Delete
|
||||||
FileListControl.editdialog.title=Edit Dialog
|
FileListControl.editdialog.title=Edit Dialog
|
||||||
FileListControl.newdialog.title=New Dialog
|
FileListControl.newdialog.title=New Dialog
|
||||||
|
|
||||||
|
# ----------- Property Page ----------
|
||||||
|
MngMakeProjectPropertyPage.closedproject=Project Closed
|
||||||
|
MngMakeProjectPropertyPage.internalError=An Internal error has occur please check error log.
|
||||||
|
|
|
@ -171,6 +171,8 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
protected Control createContents(Composite parent) {
|
protected Control createContents(Composite parent) {
|
||||||
// Initialize the key data
|
// Initialize the key data
|
||||||
targets = ManagedBuildManager.getTargets(getProject());
|
targets = ManagedBuildManager.getTargets(getProject());
|
||||||
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject(), true);
|
||||||
|
ITarget defaultTarget = info.getDefaultTarget();
|
||||||
|
|
||||||
// Create the container we return to the property page editor
|
// Create the container we return to the property page editor
|
||||||
Composite composite = ControlFactory.createComposite(parent, 1);
|
Composite composite = ControlFactory.createComposite(parent, 1);
|
||||||
|
@ -188,7 +190,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
configGroup.setLayout(form);
|
configGroup.setLayout(form);
|
||||||
|
|
||||||
Label platformLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIPlugin.getResourceString(PLATFORM_LABEL));
|
Label platformLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIPlugin.getResourceString(PLATFORM_LABEL));
|
||||||
targetSelector = ControlFactory.createSelectCombo(configGroup, getPlatformNames(), null);
|
targetSelector = ControlFactory.createSelectCombo(configGroup, getPlatformNames(), defaultTarget.getName());
|
||||||
targetSelector.addListener(SWT.Selection, new Listener () {
|
targetSelector.addListener(SWT.Selection, new Listener () {
|
||||||
public void handleEvent(Event e) {
|
public void handleEvent(Event e) {
|
||||||
handleTargetSelection();
|
handleTargetSelection();
|
||||||
|
@ -486,6 +488,13 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ITarget getSelectedTarget() {
|
||||||
|
return selectedTarget;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -683,6 +692,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
|
|
||||||
// Cache the platform at the selection index
|
// Cache the platform at the selection index
|
||||||
selectedTarget = targets[targetSelector.getSelectionIndex()];
|
selectedTarget = targets[targetSelector.getSelectionIndex()];
|
||||||
|
ManagedBuildManager.setSelectedTarget(getProject(), selectedTarget);
|
||||||
|
|
||||||
// Update the contents of the configuration widget
|
// Update the contents of the configuration widget
|
||||||
populateConfigurations();
|
populateConfigurations();
|
||||||
|
|
|
@ -0,0 +1,173 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Intel Corp - use in Managed Make system
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.managedbuilder.ui.properties;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedProjectOptionBlock;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.ui.ErrorParserBlock;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.Preferences;
|
||||||
|
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||||
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
|
import org.eclipse.jface.preference.IPreferencePageContainer;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
||||||
|
import org.eclipse.ui.dialogs.PropertyPage;
|
||||||
|
|
||||||
|
public class ManagedBuilderPropertyPage extends PropertyPage implements ICOptionContainer {
|
||||||
|
|
||||||
|
protected ManagedProjectOptionBlock fOptionBlock;
|
||||||
|
protected ITarget displayedTarget;
|
||||||
|
|
||||||
|
private static final String MSG_CLOSEDPROJECT = "MngMakeProjectPropertyPage.closedproject"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public ManagedBuilderPropertyPage() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContainer(IPreferencePageContainer preferencePageContainer) {
|
||||||
|
super.setContainer(preferencePageContainer);
|
||||||
|
if (fOptionBlock == null) {
|
||||||
|
fOptionBlock = new ManagedProjectOptionBlock(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Control createContents(Composite parent) {
|
||||||
|
Composite composite = new Composite(parent, SWT.NONE);
|
||||||
|
composite.setLayout(new FillLayout());
|
||||||
|
|
||||||
|
IProject project = getProject();
|
||||||
|
if (!project.isOpen()) {
|
||||||
|
contentForClosedProject(composite);
|
||||||
|
} else {
|
||||||
|
contentForCProject(composite);
|
||||||
|
}
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void contentForCProject(Composite parent) {
|
||||||
|
fOptionBlock.createContents(parent);
|
||||||
|
// WorkbenchHelp.setHelp(parent, ICMakeHelpContextIds.PROJECT_PROPERTY_PAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void contentForClosedProject(Composite parent) {
|
||||||
|
Label label = new Label(parent, SWT.LEFT);
|
||||||
|
label.setText(ManagedBuilderUIPlugin.getResourceString(MSG_CLOSEDPROJECT));
|
||||||
|
label.setFont(parent.getFont());
|
||||||
|
|
||||||
|
noDefaultAndApplyButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see PreferencePage#performOk
|
||||||
|
*/
|
||||||
|
public boolean performOk() {
|
||||||
|
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||||
|
public void run(IProgressMonitor monitor) {
|
||||||
|
fOptionBlock.performApply(monitor);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// If the user did not come to this page when the current selected target
|
||||||
|
// was the selected target, then there is nothing to do. The page was either
|
||||||
|
// never visited, or was visited for another target.
|
||||||
|
ITarget target = getSelectedTarget();
|
||||||
|
if (target != displayedTarget) return true;
|
||||||
|
|
||||||
|
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
|
||||||
|
try {
|
||||||
|
new ProgressMonitorDialog(getShell()).run(false, true, op);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
Throwable e1 = e.getTargetException();
|
||||||
|
ManagedBuilderUIPlugin.errorDialog(getShell(), ManagedBuilderUIPlugin.getResourceString("ManagedProjectPropertyPage.internalError"),e1.toString(), e1); //$NON-NLS-1$
|
||||||
|
return false;
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// cancelled
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write out the build model info
|
||||||
|
IProject project = getProject();
|
||||||
|
ManagedBuildManager.saveBuildInfo(project, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IProject getProject() {
|
||||||
|
Object element = getElement();
|
||||||
|
if (element instanceof IProject) {
|
||||||
|
return (IProject) element;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see DialogPage#setVisible(boolean)
|
||||||
|
*/
|
||||||
|
public void setVisible(boolean visible) {
|
||||||
|
super.setVisible(visible);
|
||||||
|
fOptionBlock.setVisible(visible);
|
||||||
|
if (visible) {
|
||||||
|
ErrorParserBlock errorParsers = fOptionBlock.getErrorParserBlock();
|
||||||
|
errorParsers.updateValues();
|
||||||
|
displayedTarget = getSelectedTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ITarget getSelectedTarget() {
|
||||||
|
// If the selected target is not yet set, set it to the default target
|
||||||
|
// The selected target is needed for saving error parser information
|
||||||
|
IProject project = getProject();
|
||||||
|
ITarget target = ManagedBuildManager.getSelectedTarget(project);
|
||||||
|
if (target == null) {
|
||||||
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project, true);
|
||||||
|
target = info.getDefaultTarget();
|
||||||
|
ManagedBuildManager.setSelectedTarget(project, target);
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateContainer() {
|
||||||
|
fOptionBlock.update();
|
||||||
|
setValid(fOptionBlock.isValid());
|
||||||
|
setErrorMessage(fOptionBlock.getErrorMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void performDefaults() {
|
||||||
|
fOptionBlock.performDefaults();
|
||||||
|
super.performDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
updateContainer();
|
||||||
|
return super.isValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getPreferences()
|
||||||
|
*/
|
||||||
|
public Preferences getPreferences() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
import org.eclipse.core.boot.BootLoader;
|
import org.eclipse.core.boot.BootLoader;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
|
@ -37,6 +38,7 @@ import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.swt.widgets.Table;
|
import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.ui.help.WorkbenchHelp;
|
import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
|
import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
|
||||||
|
|
||||||
public class CProjectPlatformPage extends WizardPage {
|
public class CProjectPlatformPage extends WizardPage {
|
||||||
/*
|
/*
|
||||||
|
@ -46,6 +48,7 @@ public class CProjectPlatformPage extends WizardPage {
|
||||||
protected ITarget selectedTarget;
|
protected ITarget selectedTarget;
|
||||||
protected String[] targetNames;
|
protected String[] targetNames;
|
||||||
protected ArrayList targets;
|
protected ArrayList targets;
|
||||||
|
protected NewManagedProjectWizard parentWizard;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dialog variables and string constants
|
* Dialog variables and string constants
|
||||||
|
@ -61,15 +64,16 @@ public class CProjectPlatformPage extends WizardPage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param wizard
|
|
||||||
* @param pageName
|
* @param pageName
|
||||||
|
* @param wizard
|
||||||
*/
|
*/
|
||||||
public CProjectPlatformPage(String pageName) {
|
public CProjectPlatformPage(String pageName, NewManagedProjectWizard parentWizard) {
|
||||||
super(pageName);
|
super(pageName);
|
||||||
setPageComplete(false);
|
setPageComplete(false);
|
||||||
populateTargets();
|
populateTargets();
|
||||||
selectedTarget = null;
|
selectedTarget = null;
|
||||||
selectedConfigurations = new ArrayList(0);
|
selectedConfigurations = new ArrayList(0);
|
||||||
|
this.parentWizard = parentWizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,7 +178,10 @@ public class CProjectPlatformPage extends WizardPage {
|
||||||
int index;
|
int index;
|
||||||
if (platformSelection != null
|
if (platformSelection != null
|
||||||
&& (index = platformSelection.getSelectionIndex()) != -1) {
|
&& (index = platformSelection.getSelectionIndex()) != -1) {
|
||||||
|
if (selectedTarget != (ITarget) targets.get(index)) {
|
||||||
selectedTarget = (ITarget) targets.get(index);
|
selectedTarget = (ITarget) targets.get(index);
|
||||||
|
parentWizard.updateTargetProperties();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
populateConfigurations();
|
populateConfigurations();
|
||||||
setPageComplete(validatePage());
|
setPageComplete(validatePage());
|
||||||
|
@ -226,4 +233,11 @@ public class CProjectPlatformPage extends WizardPage {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getProject()
|
||||||
|
*/
|
||||||
|
public IProject getProject() {
|
||||||
|
return ((NewCProjectWizard)getWizard()).getNewProject();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedProjectOptionBlock;
|
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedProjectOptionBlock;
|
||||||
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
import org.eclipse.cdt.managedbuilder.internal.ui.ErrorParserBlock;
|
||||||
import org.eclipse.cdt.ui.dialogs.ReferenceBlock;
|
import org.eclipse.cdt.ui.dialogs.ReferenceBlock;
|
||||||
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
||||||
import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
|
import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
|
||||||
|
@ -25,27 +25,48 @@ public class NewManagedProjectOptionPage extends NewCProjectWizardOptionPage {
|
||||||
|
|
||||||
public class ManagedWizardOptionBlock extends ManagedProjectOptionBlock {
|
public class ManagedWizardOptionBlock extends ManagedProjectOptionBlock {
|
||||||
|
|
||||||
public ManagedWizardOptionBlock(ICOptionContainer parent) {
|
NewManagedProjectOptionPage parent;
|
||||||
super(parent);
|
ErrorParserBlock errorParsers;
|
||||||
|
|
||||||
|
public ManagedWizardOptionBlock(NewManagedProjectOptionPage parentPage) {
|
||||||
|
super(parentPage);
|
||||||
|
parent = parentPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateTargetProperties() {
|
||||||
|
// Update the error parser list
|
||||||
|
if (errorParsers != null) {
|
||||||
|
errorParsers.updateValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock#addTabs()
|
||||||
|
*/
|
||||||
protected void addTabs() {
|
protected void addTabs() {
|
||||||
addTab(new ReferenceBlock());
|
addTab(new ReferenceBlock());
|
||||||
|
errorParsers = new ErrorParserBlock();
|
||||||
|
addTab(errorParsers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ManagedWizardOptionBlock optionBlock;
|
||||||
|
protected NewManagedProjectWizard parentWizard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pageName
|
* @param pageName
|
||||||
*/
|
*/
|
||||||
public NewManagedProjectOptionPage(String pageName) {
|
public NewManagedProjectOptionPage(String pageName, NewManagedProjectWizard parentWizard) {
|
||||||
super(pageName);
|
super(pageName);
|
||||||
|
this.parentWizard = parentWizard;
|
||||||
|
optionBlock = new ManagedWizardOptionBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.ui.wizards.NewCProjectWizardOptionPage#createOptionBlock()
|
* @see org.eclipse.cdt.ui.wizards.NewCProjectWizardOptionPage#createOptionBlock()
|
||||||
*/
|
*/
|
||||||
protected TabFolderOptionBlock createOptionBlock() {
|
protected TabFolderOptionBlock createOptionBlock() {
|
||||||
return new ManagedWizardOptionBlock(this);
|
return optionBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -62,4 +83,8 @@ public class NewManagedProjectOptionPage extends NewCProjectWizardOptionPage {
|
||||||
return ManagedBuilderUIPlugin.getDefault().getPluginPreferences();
|
return ManagedBuilderUIPlugin.getDefault().getPluginPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateTargetProperties() {
|
||||||
|
// Update the error parser list
|
||||||
|
optionBlock.updateTargetProperties();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,18 +64,23 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
|
||||||
super.addPages();
|
super.addPages();
|
||||||
|
|
||||||
// Add the configuration selection page
|
// Add the configuration selection page
|
||||||
targetConfigurationPage = new CProjectPlatformPage(PREFIX);
|
targetConfigurationPage = new CProjectPlatformPage(PREFIX, this);
|
||||||
targetConfigurationPage.setTitle(ManagedBuilderUIPlugin.getResourceString(CONF_TITLE));
|
targetConfigurationPage.setTitle(ManagedBuilderUIPlugin.getResourceString(CONF_TITLE));
|
||||||
targetConfigurationPage.setDescription(ManagedBuilderUIPlugin.getResourceString(CONF_DESC));
|
targetConfigurationPage.setDescription(ManagedBuilderUIPlugin.getResourceString(CONF_DESC));
|
||||||
addPage(targetConfigurationPage);
|
addPage(targetConfigurationPage);
|
||||||
|
|
||||||
// Add the options (tabbed) page
|
// Add the options (tabbed) page
|
||||||
optionPage = new NewManagedProjectOptionPage(PREFIX);
|
optionPage = new NewManagedProjectOptionPage(PREFIX, this);
|
||||||
optionPage.setTitle(ManagedBuilderUIPlugin.getResourceString(OPTIONS_TITLE));
|
optionPage.setTitle(ManagedBuilderUIPlugin.getResourceString(OPTIONS_TITLE));
|
||||||
optionPage.setDescription(ManagedBuilderUIPlugin.getResourceString(OPTIONS_DESC));
|
optionPage.setDescription(ManagedBuilderUIPlugin.getResourceString(OPTIONS_DESC));
|
||||||
addPage(optionPage);
|
addPage(optionPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateTargetProperties() {
|
||||||
|
// Update the error parser list
|
||||||
|
optionPage.updateTargetProperties();
|
||||||
|
}
|
||||||
|
|
||||||
protected void doRun(IProgressMonitor monitor) throws CoreException {
|
protected void doRun(IProgressMonitor monitor) throws CoreException {
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
@ -99,11 +104,6 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
|
||||||
// Bail out of the project creation
|
// Bail out of the project creation
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify the project settings
|
|
||||||
if (newProject != null) {
|
|
||||||
optionPage.performApply(new SubProgressMonitor(monitor, 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the target to the project
|
// Add the target to the project
|
||||||
ITarget newTarget = null;
|
ITarget newTarget = null;
|
||||||
try {
|
try {
|
||||||
|
@ -128,6 +128,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
|
||||||
if (newConfigs.length > 0) {
|
if (newConfigs.length > 0) {
|
||||||
ManagedBuildManager.setDefaultConfiguration(newProject, newConfigs[0]);
|
ManagedBuildManager.setDefaultConfiguration(newProject, newConfigs[0]);
|
||||||
}
|
}
|
||||||
|
ManagedBuildManager.setSelectedTarget(newProject, newTarget);
|
||||||
}
|
}
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
// TODO Flag the error to the user
|
// TODO Flag the error to the user
|
||||||
|
@ -146,6 +147,11 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
|
||||||
// TODO Flag the error to the user
|
// TODO Flag the error to the user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Modify the project settings
|
||||||
|
if (newProject != null) {
|
||||||
|
optionPage.performApply(new SubProgressMonitor(monitor, 2));
|
||||||
|
}
|
||||||
|
|
||||||
// Save the build options
|
// Save the build options
|
||||||
monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_SAVE));
|
monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_SAVE));
|
||||||
ManagedBuildManager.saveBuildInfo(newProject, true);
|
ManagedBuildManager.saveBuildInfo(newProject, true);
|
||||||
|
@ -176,4 +182,8 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
|
||||||
// return ManagedBuilderCorePlugin.getUniqueIdentifier() + ".make"; //$NON-NLS-1$
|
// return ManagedBuilderCorePlugin.getUniqueIdentifier() + ".make"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ITarget getSelectedTarget() {
|
||||||
|
return targetConfigurationPage.getSelectedTarget();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue