mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +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.ui.BuildPathInfoBlock;
|
||||
import org.eclipse.cdt.make.ui.SettingsBlock;
|
||||
import org.eclipse.cdt.ui.TabFolderOptionBlock;
|
||||
import org.eclipse.cdt.ui.BinaryParserBlock;
|
||||
import org.eclipse.cdt.ui.ICOptionContainer;
|
||||
import org.eclipse.swt.widgets.TabItem;
|
||||
import org.eclipse.cdt.ui.TabFolderOptionBlock;
|
||||
|
||||
public class MakeProjectOptionBlock extends TabFolderOptionBlock {
|
||||
|
||||
|
@ -23,11 +22,10 @@ public class MakeProjectOptionBlock extends TabFolderOptionBlock {
|
|||
super(parent);
|
||||
}
|
||||
|
||||
protected TabItem addTabs() {
|
||||
TabItem item = addTab(new SettingsBlock(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID));
|
||||
protected void addTabs() {
|
||||
addTab(new SettingsBlock(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID));
|
||||
addTab(new BinaryParserBlock(MakeCorePlugin.getDefault().getPluginPreferences()));
|
||||
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.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.deselectAll=Deselect All
|
||||
WizardCheckboxTablePart.WizardCheckboxTablePart.counter={0} of {1} Selected
|
||||
|
|
|
@ -61,7 +61,7 @@ public class MakePreferencePage extends PreferencePage implements IWorkbenchPref
|
|||
}
|
||||
|
||||
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();
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
fOptionBlock.performOk(monitor);
|
||||
fOptionBlock.performApply(monitor);
|
||||
}
|
||||
};
|
||||
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
|
||||
|
|
|
@ -6,19 +6,25 @@
|
|||
* Contributors:
|
||||
* 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.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
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.ui.wizards.UpdateMakeProjectWizard;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
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.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.operation.IRunnableContext;
|
||||
|
@ -78,7 +84,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
try {
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
doMakeProjectUpdate(monitor, projects);
|
||||
doProjectUpdate(monitor, projects);
|
||||
}
|
||||
};
|
||||
MakeUIPlugin.getWorkspace().run(runnable, monitor);
|
||||
|
@ -96,15 +102,30 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
public static void doMakeProjectUpdate(IProgressMonitor monitor, IProject[] projects) throws CoreException {
|
||||
// dinglis-TODO : Implement Make project updating.
|
||||
monitor.beginTask("Updating make Projects...", projects.length);
|
||||
protected static void doProjectUpdate(IProgressMonitor monitor, IProject[] project) throws CoreException {
|
||||
monitor.beginTask("Updating make Projects...", project.length * 3);
|
||||
try {
|
||||
for (int i = 0; i < projects.length; i++) {
|
||||
// IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
|
||||
for (int i = 0; i < project.length; i++) {
|
||||
// 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())
|
||||
break;
|
||||
//remove old properties
|
||||
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 {
|
||||
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.ui.TabFolderOptionBlock;
|
||||
import org.eclipse.cdt.ui.ICOptionContainer;
|
||||
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.CProjectWizardOptionPage;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.swt.widgets.TabItem;
|
||||
|
||||
/**
|
||||
* Standard main page for a wizard that is creates a project resource.
|
||||
|
@ -36,10 +35,9 @@ public class MakeProjectWizardOptionPage extends CProjectWizardOptionPage {
|
|||
super(parent);
|
||||
}
|
||||
|
||||
protected TabItem addTabs() {
|
||||
TabItem item = addTab(new ReferenceBlock());
|
||||
protected void addTabs() {
|
||||
addTab(new ReferenceBlock());
|
||||
super.addTabs();
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,19 +6,22 @@
|
|||
* Contributors:
|
||||
* 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.jface.wizard.Wizard;
|
||||
|
||||
public class UpdateMakeProjectWizard extends Wizard {
|
||||
private static final String MAKE_UPDATE_WINDOW_TITLE = "MakeWizardUpdate.window_title";
|
||||
|
||||
private UpdateMakeProjectWizardPage page1;
|
||||
private IProject[] selected;
|
||||
|
||||
public UpdateMakeProjectWizard(IProject[] selected) {
|
||||
setDefaultPageImageDescriptor(null);
|
||||
setWindowTitle("Update Makefile Projects");
|
||||
setWindowTitle(MakeUIPlugin.getResourceString(MAKE_UPDATE_WINDOW_TITLE));
|
||||
setNeedsProgressMonitor(true);
|
||||
this.selected = selected;
|
||||
}
|
|
@ -6,11 +6,18 @@
|
|||
* Contributors:
|
||||
* 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.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.IProjectDescription;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||
|
@ -25,11 +32,14 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
|
|||
|
||||
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 CheckboxTableViewer makeProjectListViewer;
|
||||
private TablePart tablePart;
|
||||
|
||||
public class BuildpathContentProvider implements IStructuredContentProvider {
|
||||
public class MakeProjectContentProvider implements IStructuredContentProvider {
|
||||
public Object[] getElements(Object parent) {
|
||||
return getProjects();
|
||||
}
|
||||
|
@ -57,10 +67,10 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
|||
|
||||
public UpdateMakeProjectWizardPage(IProject[] selected) {
|
||||
super("UpdateMakeProjectWizardPage", true);
|
||||
setTitle("Make update title");
|
||||
setDescription("Make update description");
|
||||
setTitle(MakeUIPlugin.getResourceString(MAKE_UPDATE_TITLE));
|
||||
setDescription(MakeUIPlugin.getResourceString(MAKE_UPDATE_DESCRIPTION));
|
||||
this.selected = selected;
|
||||
tablePart = new TablePart("project list");
|
||||
tablePart = new TablePart("Project list");
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
@ -77,7 +87,7 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
|||
|
||||
tablePart.createControl(container);
|
||||
makeProjectListViewer = tablePart.getTableViewer();
|
||||
makeProjectListViewer.setContentProvider(new BuildpathContentProvider());
|
||||
makeProjectListViewer.setContentProvider(new MakeProjectContentProvider());
|
||||
makeProjectListViewer.setLabelProvider(new WorkbenchLabelProvider());
|
||||
|
||||
GridData gd = (GridData) tablePart.getControl().getLayoutData();
|
||||
|
@ -102,16 +112,25 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
|||
updateStatus(genStatus);
|
||||
}
|
||||
|
||||
private IProject[] getProjects() {
|
||||
return MakeUIPlugin.getWorkspace().getRoot().getProjects();
|
||||
// Vector result = new Vector();
|
||||
// try {
|
||||
//
|
||||
// } catch (CoreException e) {
|
||||
//// MakeUIPlugin.logException(e);
|
||||
// }
|
||||
protected IProject[] getProjects() {
|
||||
IProject[] project = MakeUIPlugin.getWorkspace().getRoot().getProjects();
|
||||
Vector result = new Vector();
|
||||
try {
|
||||
for (int i = 0; i < project.length; i++) {
|
||||
IProjectDescription desc = project[i].getDescription();
|
||||
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() {
|
||||
|
@ -125,4 +144,3 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
|
|||
return createStatus(IStatus.OK, "");
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue