mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
update
This commit is contained in:
parent
6acb69e971
commit
dc9fe084f3
8 changed files with 81 additions and 39 deletions
|
@ -12,10 +12,9 @@ import org.eclipse.cdt.make.core.MakeBuilder;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.ui.BuildPathInfoBlock;
|
import org.eclipse.cdt.make.ui.BuildPathInfoBlock;
|
||||||
import org.eclipse.cdt.make.ui.SettingsBlock;
|
import org.eclipse.cdt.make.ui.SettingsBlock;
|
||||||
import org.eclipse.cdt.ui.TabFolderOptionBlock;
|
|
||||||
import org.eclipse.cdt.ui.BinaryParserBlock;
|
import org.eclipse.cdt.ui.BinaryParserBlock;
|
||||||
import org.eclipse.cdt.ui.ICOptionContainer;
|
import org.eclipse.cdt.ui.ICOptionContainer;
|
||||||
import org.eclipse.swt.widgets.TabItem;
|
import org.eclipse.cdt.ui.TabFolderOptionBlock;
|
||||||
|
|
||||||
public class MakeProjectOptionBlock extends TabFolderOptionBlock {
|
public class MakeProjectOptionBlock extends TabFolderOptionBlock {
|
||||||
|
|
||||||
|
@ -23,11 +22,10 @@ public class MakeProjectOptionBlock extends TabFolderOptionBlock {
|
||||||
super(parent);
|
super(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TabItem addTabs() {
|
protected void addTabs() {
|
||||||
TabItem item = addTab(new SettingsBlock(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID));
|
addTab(new SettingsBlock(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID));
|
||||||
addTab(new BinaryParserBlock(MakeCorePlugin.getDefault().getPluginPreferences()));
|
addTab(new BinaryParserBlock(MakeCorePlugin.getDefault().getPluginPreferences()));
|
||||||
addTab(new BuildPathInfoBlock());
|
addTab(new BuildPathInfoBlock());
|
||||||
return item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ MakeCWizardSettings.description=Define the project and 'make' builder settings
|
||||||
MakeCCWizardSettings.title=C++/Make Project Settings
|
MakeCCWizardSettings.title=C++/Make Project Settings
|
||||||
MakeCCWizardSettings.description=Define the project and 'make' builder settings
|
MakeCCWizardSettings.description=Define the project and 'make' builder settings
|
||||||
|
|
||||||
|
MakeWizardUpdate.window_title=Make Project Migration
|
||||||
|
MakeWizardUpdatePage.title=Make Project Migration
|
||||||
|
MakeWizardUpdatePage.description=Migrate older make projects to new make builder.
|
||||||
|
|
||||||
WizardCheckboxTablePart.WizardCheckboxTablePart.selectAll=Select All
|
WizardCheckboxTablePart.WizardCheckboxTablePart.selectAll=Select All
|
||||||
WizardCheckboxTablePart.WizardCheckboxTablePart.deselectAll=Deselect All
|
WizardCheckboxTablePart.WizardCheckboxTablePart.deselectAll=Deselect All
|
||||||
WizardCheckboxTablePart.WizardCheckboxTablePart.counter={0} of {1} Selected
|
WizardCheckboxTablePart.WizardCheckboxTablePart.counter={0} of {1} Selected
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class MakePreferencePage extends PreferencePage implements IWorkbenchPref
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
return fOptionBlock.performOk(null);
|
return fOptionBlock.performApply(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer
|
||||||
Shell shell = getControl().getShell();
|
Shell shell = getControl().getShell();
|
||||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||||
fOptionBlock.performOk(monitor);
|
fOptionBlock.performApply(monitor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
|
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
|
||||||
|
|
|
@ -6,19 +6,25 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.ui.wizards;
|
package org.eclipse.cdt.make.ui.actions;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
|
import org.eclipse.cdt.make.core.MakeProjectNature;
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
|
import org.eclipse.cdt.make.ui.wizards.UpdateMakeProjectWizard;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
import org.eclipse.jface.operation.IRunnableContext;
|
||||||
|
@ -78,7 +84,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
||||||
try {
|
try {
|
||||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
doMakeProjectUpdate(monitor, projects);
|
doProjectUpdate(monitor, projects);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MakeUIPlugin.getWorkspace().run(runnable, monitor);
|
MakeUIPlugin.getWorkspace().run(runnable, monitor);
|
||||||
|
@ -96,15 +102,30 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void doMakeProjectUpdate(IProgressMonitor monitor, IProject[] projects) throws CoreException {
|
protected static void doProjectUpdate(IProgressMonitor monitor, IProject[] project) throws CoreException {
|
||||||
// dinglis-TODO : Implement Make project updating.
|
monitor.beginTask("Updating make Projects...", project.length * 3);
|
||||||
monitor.beginTask("Updating make Projects...", projects.length);
|
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < projects.length; i++) {
|
for (int i = 0; i < project.length; i++) {
|
||||||
// IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
|
// remove old builder
|
||||||
|
MakeProjectNature.removeFromBuildSpec(
|
||||||
|
project[i],
|
||||||
|
MakeCorePlugin.OLD_BUILDER_ID,
|
||||||
|
new SubProgressMonitor(monitor, 1));
|
||||||
|
// add new nature
|
||||||
|
MakeProjectNature.addNature(project[i], new SubProgressMonitor(monitor, 1));
|
||||||
|
QualifiedName qlocation = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation"),
|
||||||
|
String location = project[i].getPersistentProperty(qlocation);
|
||||||
|
|
||||||
if (monitor.isCanceled())
|
//remove old properties
|
||||||
break;
|
QualifiedName[] qName =
|
||||||
|
{
|
||||||
|
new QualifiedName(CCorePlugin.PLUGIN_ID, "buildFullArguments"),
|
||||||
|
new QualifiedName(CCorePlugin.PLUGIN_ID, "buildIncrementalArguments"),
|
||||||
|
new QualifiedName("org.eclipse.cdt", "make.goals")};
|
||||||
|
for (int j = 0; j < qName.length; j++) {
|
||||||
|
project[i].setPersistentProperty(qName[j], null);
|
||||||
|
}
|
||||||
|
monitor.worked(1);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
monitor.done();
|
monitor.done();
|
|
@ -6,13 +6,12 @@ package org.eclipse.cdt.make.ui.wizards;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeProjectOptionBlock;
|
import org.eclipse.cdt.make.internal.ui.MakeProjectOptionBlock;
|
||||||
import org.eclipse.cdt.ui.TabFolderOptionBlock;
|
|
||||||
import org.eclipse.cdt.ui.ICOptionContainer;
|
import org.eclipse.cdt.ui.ICOptionContainer;
|
||||||
import org.eclipse.cdt.ui.ReferenceBlock;
|
import org.eclipse.cdt.ui.ReferenceBlock;
|
||||||
|
import org.eclipse.cdt.ui.TabFolderOptionBlock;
|
||||||
import org.eclipse.cdt.ui.wizards.CProjectWizard;
|
import org.eclipse.cdt.ui.wizards.CProjectWizard;
|
||||||
import org.eclipse.cdt.ui.wizards.CProjectWizardOptionPage;
|
import org.eclipse.cdt.ui.wizards.CProjectWizardOptionPage;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.swt.widgets.TabItem;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard main page for a wizard that is creates a project resource.
|
* Standard main page for a wizard that is creates a project resource.
|
||||||
|
@ -36,10 +35,9 @@ public class MakeProjectWizardOptionPage extends CProjectWizardOptionPage {
|
||||||
super(parent);
|
super(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TabItem addTabs() {
|
protected void addTabs() {
|
||||||
TabItem item = addTab(new ReferenceBlock());
|
addTab(new ReferenceBlock());
|
||||||
super.addTabs();
|
super.addTabs();
|
||||||
return item;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,19 +6,22 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.ui.wizards;
|
package org.eclipse.cdt.make.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
|
import org.eclipse.cdt.make.ui.actions.*;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.jface.wizard.Wizard;
|
import org.eclipse.jface.wizard.Wizard;
|
||||||
|
|
||||||
public class UpdateMakeProjectWizard extends Wizard {
|
public class UpdateMakeProjectWizard extends Wizard {
|
||||||
|
private static final String MAKE_UPDATE_WINDOW_TITLE = "MakeWizardUpdate.window_title";
|
||||||
|
|
||||||
private UpdateMakeProjectWizardPage page1;
|
private UpdateMakeProjectWizardPage page1;
|
||||||
private IProject[] selected;
|
private IProject[] selected;
|
||||||
|
|
||||||
public UpdateMakeProjectWizard(IProject[] selected) {
|
public UpdateMakeProjectWizard(IProject[] selected) {
|
||||||
setDefaultPageImageDescriptor(null);
|
setDefaultPageImageDescriptor(null);
|
||||||
setWindowTitle("Update Makefile Projects");
|
setWindowTitle(MakeUIPlugin.getResourceString(MAKE_UPDATE_WINDOW_TITLE));
|
||||||
setNeedsProgressMonitor(true);
|
setNeedsProgressMonitor(true);
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
}
|
}
|
|
@ -6,11 +6,18 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.ui.wizards;
|
package org.eclipse.cdt.make.ui.wizards;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
import org.eclipse.cdt.make.internal.ui.part.WizardCheckboxTablePart;
|
import org.eclipse.cdt.make.internal.ui.part.WizardCheckboxTablePart;
|
||||||
|
import org.eclipse.cdt.make.internal.ui.wizards.StatusWizardPage;
|
||||||
|
import org.eclipse.core.resources.ICommand;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||||
|
@ -25,11 +32,14 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
|
||||||
|
|
||||||
public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
||||||
|
|
||||||
|
private static final String MAKE_UPDATE_TITLE = "MakeWizardUpdatePage.title";
|
||||||
|
private static final String MAKE_UPDATE_DESCRIPTION = "MakeWizardUpdatePage.description";
|
||||||
|
|
||||||
private IProject[] selected;
|
private IProject[] selected;
|
||||||
private CheckboxTableViewer makeProjectListViewer;
|
private CheckboxTableViewer makeProjectListViewer;
|
||||||
private TablePart tablePart;
|
private TablePart tablePart;
|
||||||
|
|
||||||
public class BuildpathContentProvider implements IStructuredContentProvider {
|
public class MakeProjectContentProvider implements IStructuredContentProvider {
|
||||||
public Object[] getElements(Object parent) {
|
public Object[] getElements(Object parent) {
|
||||||
return getProjects();
|
return getProjects();
|
||||||
}
|
}
|
||||||
|
@ -57,10 +67,10 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
||||||
|
|
||||||
public UpdateMakeProjectWizardPage(IProject[] selected) {
|
public UpdateMakeProjectWizardPage(IProject[] selected) {
|
||||||
super("UpdateMakeProjectWizardPage", true);
|
super("UpdateMakeProjectWizardPage", true);
|
||||||
setTitle("Make update title");
|
setTitle(MakeUIPlugin.getResourceString(MAKE_UPDATE_TITLE));
|
||||||
setDescription("Make update description");
|
setDescription(MakeUIPlugin.getResourceString(MAKE_UPDATE_DESCRIPTION));
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
tablePart = new TablePart("project list");
|
tablePart = new TablePart("Project list");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -77,7 +87,7 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
||||||
|
|
||||||
tablePart.createControl(container);
|
tablePart.createControl(container);
|
||||||
makeProjectListViewer = tablePart.getTableViewer();
|
makeProjectListViewer = tablePart.getTableViewer();
|
||||||
makeProjectListViewer.setContentProvider(new BuildpathContentProvider());
|
makeProjectListViewer.setContentProvider(new MakeProjectContentProvider());
|
||||||
makeProjectListViewer.setLabelProvider(new WorkbenchLabelProvider());
|
makeProjectListViewer.setLabelProvider(new WorkbenchLabelProvider());
|
||||||
|
|
||||||
GridData gd = (GridData) tablePart.getControl().getLayoutData();
|
GridData gd = (GridData) tablePart.getControl().getLayoutData();
|
||||||
|
@ -102,16 +112,25 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
||||||
updateStatus(genStatus);
|
updateStatus(genStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IProject[] getProjects() {
|
protected IProject[] getProjects() {
|
||||||
return MakeUIPlugin.getWorkspace().getRoot().getProjects();
|
IProject[] project = MakeUIPlugin.getWorkspace().getRoot().getProjects();
|
||||||
// Vector result = new Vector();
|
Vector result = new Vector();
|
||||||
// try {
|
try {
|
||||||
//
|
for (int i = 0; i < project.length; i++) {
|
||||||
// } catch (CoreException e) {
|
IProjectDescription desc = project[i].getDescription();
|
||||||
//// MakeUIPlugin.logException(e);
|
ICommand builder[] = desc.getBuildSpec();
|
||||||
// }
|
for( int j = 0; j < builder.length; j++ ) {
|
||||||
|
if (builder[j].getBuilderName().equals(MakeCorePlugin.OLD_BUILDER_ID)) {
|
||||||
|
result.add(project[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
MakeUIPlugin.logException(e);
|
||||||
|
}
|
||||||
|
|
||||||
// return (IProject[])result.toArray(new IProject[result.size()]);
|
return (IProject[]) result.toArray(new IProject[result.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IStatus validatePlugins() {
|
private IStatus validatePlugins() {
|
||||||
|
@ -125,4 +144,3 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
||||||
return createStatus(IStatus.OK, "");
|
return createStatus(IStatus.OK, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue