mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fixed bug#43605
cleanup ui actions Create/Build target so they can be made availible though a hotkey
This commit is contained in:
parent
6b17a6477b
commit
4833b2d494
10 changed files with 217 additions and 180 deletions
|
@ -7,20 +7,22 @@ WizardNewCMakeProject.description=Create a new C Project which uses a simple mak
|
|||
WizardNewCCMakeProject.name=Standard Make C++ Project
|
||||
WizardNewCCMakeProject.description=Create a new C++ Project which uses a simple makefile.
|
||||
|
||||
WizardConvertMakeProject.name=Convert to Make Project
|
||||
WizardConvertMakeProject.description=Convert a C/C++ Project to use a simple makefile
|
||||
|
||||
MenuMakeNew.label=Make Builds
|
||||
WizardConvertMakeProject.name=Convert to a C/C++ Make Project
|
||||
WizardConvertMakeProject.description=Convert to a C/C++ Project which uses a simple makefile
|
||||
|
||||
ActionMakeCreateTarget.label=Create Make Target...
|
||||
ActionMakeBuildTarget.label=Build Make Target...
|
||||
|
||||
ActionMakeUpdate.label=Update Old Make Project...
|
||||
ActionMakeUpdate.tooltip=Update Old Make Project
|
||||
|
||||
CommandMakeBuildCreate.name=Build/Create Make Target
|
||||
CommandMakeBuildCreate.description=Build or create a new make build target
|
||||
CommandTargetBuild.name=Make Target Build
|
||||
CommandTargetBuild.description=Invoke a make target build for the selected container.
|
||||
CommandTargetCreate.name=Create Make Target
|
||||
CommandTargetCreate.description=Create a new make build target for the selected container.
|
||||
|
||||
PreferenceMakeProject.name=New Make Projects
|
||||
|
||||
PropertyMakeProject.name= C/C++ Make Project
|
||||
|
||||
ViewCatagoryMake.name=Make
|
||||
|
@ -28,6 +30,3 @@ ViewMake.name=Make Targets
|
|||
|
||||
ActionSetMake.label=Make Actions
|
||||
ActionSetUpdateMake.label=Update Make Projects
|
||||
|
||||
CommandMakeBuild.name=Make Target Build
|
||||
CommandMakeBuild.description=Invoke a make target build for the selected container.
|
|
@ -39,12 +39,14 @@
|
|||
icon="icons/ctool16/convert-normal.gif"
|
||||
category="org.eclipse.cdt.ui.newCWizards"
|
||||
class="org.eclipse.cdt.make.ui.wizards.ConvertToMakeProjectWizard"
|
||||
project="true"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
id="org.eclipse.cdt.ui.wizards.ConvertToMakeWizard">
|
||||
<description>
|
||||
%MakeConversionWizard.description
|
||||
%WizardConvertMakeProject.description
|
||||
</description>
|
||||
<selection
|
||||
class="org.eclipse.core.resources.IProject">
|
||||
</selection>
|
||||
</wizard>
|
||||
<!-- For C++ Wizards -->
|
||||
<wizard
|
||||
|
@ -64,12 +66,14 @@
|
|||
icon="icons/ctool16/convert-normal.gif"
|
||||
category="org.eclipse.cdt.ui.newCCWizards"
|
||||
class="org.eclipse.cdt.make.ui.wizards.ConvertToMakeProjectWizard"
|
||||
project="true"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
id="org.eclipse.cdt.ui.wizards.ConvertToMakeWizard">
|
||||
<description>
|
||||
%MakeConversionWizard.description
|
||||
%WizardConvertMakeProject.description
|
||||
</description>
|
||||
<selection
|
||||
class="org.eclipse.core.resources.IProject">
|
||||
</selection>
|
||||
</wizard>
|
||||
</extension>
|
||||
<extension
|
||||
|
@ -113,58 +117,20 @@
|
|||
value="org.eclipse.cdt.make.core.makeNature">
|
||||
</filter>
|
||||
</objectContribution>
|
||||
<objectContribution
|
||||
objectClass="org.eclipse.core.resources.IProject"
|
||||
adaptable="true"
|
||||
id="org.eclipse.cdt.make.ui.popupMenu.UpdateContribution">
|
||||
<visibility>
|
||||
<and>
|
||||
<not>
|
||||
<objectState
|
||||
name="nature"
|
||||
value="org.eclipse.cdt.make.core.makeNature">
|
||||
</objectState>
|
||||
</not>
|
||||
<objectState
|
||||
name="nature"
|
||||
value="org.eclipse.cdt.core.cnature">
|
||||
</objectState>
|
||||
<or>
|
||||
<objectState
|
||||
name="projectPersistentProperty"
|
||||
value="org.eclipse.cdt.core.buildLocation">
|
||||
</objectState>
|
||||
<objectState
|
||||
name="projectPersistentProperty"
|
||||
value="org.eclipse.cdt.core.buildFullArguments">
|
||||
</objectState>
|
||||
<objectState
|
||||
name="projectPersistentProperty"
|
||||
value="org.eclipse.cdt.core.buildIncrementalArguments">
|
||||
</objectState>
|
||||
<objectState
|
||||
name="projectPersistentProperty"
|
||||
value="org.eclipse.cdt.make.goals">
|
||||
</objectState>
|
||||
</or>
|
||||
</and>
|
||||
</visibility>
|
||||
<action
|
||||
label="%ActionMakeUpdate.label"
|
||||
icon="icons/ctool16/update_old.gif"
|
||||
class="org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction"
|
||||
enablesFor="+"
|
||||
id="org.eclipse.cdt.make.ui.UpdateProjectMakeAction">
|
||||
</action>
|
||||
</objectContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.commands">
|
||||
<command
|
||||
name="%CommandMakeBuild.name"
|
||||
description="%CommandMakeBuild.description"
|
||||
name="%CommandTargetBuild.name"
|
||||
description="%CommandTargetBuild.description"
|
||||
category="org.eclipse.ui.category.project"
|
||||
id="org.eclipse.cdt.make.ui.makeTargetCommand">
|
||||
id="org.eclipse.cdt.make.ui.targetBuildCommand">
|
||||
</command>
|
||||
<command
|
||||
name="%CommandTargetCreate.name"
|
||||
description="%CommandTargetCreate.description"
|
||||
category="org.eclipse.ui.category.project"
|
||||
id="org.eclipse.cdt.make.ui.targetCreateCommand">
|
||||
</command>
|
||||
</extension>
|
||||
<extension
|
||||
|
@ -220,48 +186,56 @@
|
|||
<and>
|
||||
<not>
|
||||
<objectState
|
||||
name="nature"
|
||||
name="projectNature"
|
||||
value="org.eclipse.cdt.make.core.makeNature">
|
||||
</objectState>
|
||||
</not>
|
||||
<objectState
|
||||
name="nature"
|
||||
name="projectNature"
|
||||
value="org.eclipse.cdt.core.cnature">
|
||||
</objectState>
|
||||
<or>
|
||||
<objectState
|
||||
name="projectPersistentProperty"
|
||||
value="org.eclipse.cdt.core.buildLocation">
|
||||
</objectState>
|
||||
<objectState
|
||||
name="projectPersistentProperty"
|
||||
value="org.eclipse.cdt.core.buildFullArguments">
|
||||
</objectState>
|
||||
<objectState
|
||||
name="projectPersistentProperty"
|
||||
value="org.eclipse.cdt.core.buildIncrementalArguments">
|
||||
</objectState>
|
||||
<objectState
|
||||
name="projectPersistentProperty"
|
||||
value="org.eclipse.cdt.make.goals">
|
||||
</objectState>
|
||||
</or>
|
||||
</and>
|
||||
</enablement>
|
||||
</action>
|
||||
</actionSet>
|
||||
<actionSet
|
||||
label="%ActionSetMakeTarget.name"
|
||||
label="%ActionSetMake.label"
|
||||
id="org.eclipse.cdt.make.ui.makeTargetActionSet">
|
||||
<action
|
||||
definitionId="org.eclipse.cdt.make.ui.makeTargetCommand"
|
||||
label="%ActionMakeBuildTarget.name"
|
||||
definitionId="org.eclipse.cdt.make.ui.targetBuildCommand"
|
||||
label="%ActionMakeBuildTarget.label"
|
||||
class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
|
||||
menubarPath="project/additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.make.ui.makeTargetAction">
|
||||
<selection
|
||||
class="org.eclipse.core.resources.IContainer">
|
||||
</selection>
|
||||
<enablement>
|
||||
<or>
|
||||
<objectClass
|
||||
name="org.eclipse.core.resources.IContainer">
|
||||
</objectClass>
|
||||
<objectClass
|
||||
name="org.eclipse.cdt.core.model.ICContainer">
|
||||
</objectClass>
|
||||
</or>
|
||||
</enablement>
|
||||
</action>
|
||||
<action
|
||||
definitionId="org.eclipse.cdt.make.ui.targetCreateCommand"
|
||||
label="%ActionMakeCreateTarget.label"
|
||||
class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
|
||||
menubarPath="project/additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.make.ui.createTargetAction">
|
||||
<enablement>
|
||||
<or>
|
||||
<objectClass
|
||||
name="org.eclipse.core.resources.IContainer">
|
||||
</objectClass>
|
||||
<objectClass
|
||||
name="org.eclipse.cdt.core.model.ICContainer">
|
||||
</objectClass>
|
||||
</or>
|
||||
</enablement>
|
||||
</action>
|
||||
</actionSet>
|
||||
</extension>
|
||||
|
@ -296,6 +270,9 @@
|
|||
<viewShortcut
|
||||
id="org.eclipse.cdt.make.ui.views.MakeView">
|
||||
</viewShortcut>
|
||||
<actionSet
|
||||
id="org.eclipse.cdt.make.ui.makeTargetActionSet">
|
||||
</actionSet>
|
||||
</perspectiveExtension>
|
||||
</extension>
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ MakeCWizardSettings.description=Define the project and 'make' builder settings
|
|||
MakeCCWizardSettings.title=C++/Make Project Settings
|
||||
MakeCCWizardSettings.description=Define the project and 'make' builder settings
|
||||
|
||||
WizardMakeProjectConversion.title=Convert to C/C++ Make project
|
||||
WizardMakeProjectConversion.description=Convert a prject to a C/C++ project which uses 'make' to build it.
|
||||
|
||||
MakeWizardUpdate.window_title=Make Project Migration
|
||||
MakeWizardUpdatePage.title=Make Project Migration
|
||||
MakeWizardUpdatePage.description=Migrate older make projects to new make builder.
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Created on 25-Sep-2003
|
||||
*
|
||||
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.make.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICContainer;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
|
||||
public abstract class AbstractTargetAction
|
||||
extends ActionDelegate
|
||||
implements IObjectActionDelegate, IWorkbenchWindowActionDelegate {
|
||||
private IWorkbenchPart fPart;
|
||||
private IWorkbenchWindow fWindow;
|
||||
private IContainer fContainer;
|
||||
|
||||
protected Shell getShell() {
|
||||
if (fPart != null) {
|
||||
return fPart.getSite().getShell();
|
||||
} else if (fWindow != null) {
|
||||
return fWindow.getShell();
|
||||
}
|
||||
return MakeUIPlugin.getActiveWorkbenchShell();
|
||||
}
|
||||
|
||||
protected IContainer getSelectedContainer() {
|
||||
return fContainer;
|
||||
}
|
||||
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
fPart = targetPart;
|
||||
}
|
||||
|
||||
public void init(IWorkbenchWindow window) {
|
||||
fWindow = window;
|
||||
}
|
||||
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
boolean enabled = false;
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
IStructuredSelection sel = (IStructuredSelection) selection;
|
||||
if (sel.getFirstElement() instanceof ICContainer) {
|
||||
fContainer = (IContainer) ((ICContainer) sel.getFirstElement()).getUnderlyingResource();
|
||||
} else if (sel.getFirstElement() instanceof IContainer) {
|
||||
fContainer = (IContainer) sel.getFirstElement();
|
||||
} else {
|
||||
fContainer = null;
|
||||
}
|
||||
if (fContainer != null && MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(fContainer.getProject())) {
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
action.setEnabled(enabled);
|
||||
}
|
||||
|
||||
}
|
|
@ -8,7 +8,6 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.make.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICContainer;
|
||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
|
@ -19,39 +18,30 @@ import org.eclipse.core.runtime.IPath;
|
|||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
|
||||
public class BuildTargetAction extends ActionDelegate implements IObjectActionDelegate, IWorkbenchWindowActionDelegate {
|
||||
|
||||
IWorkbenchPart fPart;
|
||||
IContainer fContainer;
|
||||
public class BuildTargetAction extends AbstractTargetAction {
|
||||
|
||||
public void run(IAction action) {
|
||||
if (fContainer != null) {
|
||||
BuildTargetDialog dialog = new BuildTargetDialog(fPart.getSite().getShell(), fContainer);
|
||||
IContainer container = getSelectedContainer();
|
||||
if (container != null) {
|
||||
BuildTargetDialog dialog = new BuildTargetDialog(getShell(), container);
|
||||
String name = null;
|
||||
try {
|
||||
name = (String) fContainer.getSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"));
|
||||
name = (String) container.getSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"));
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if ( name != null) {
|
||||
IPath path = new Path(name);
|
||||
name = path.segment(path.segmentCount() - 1);
|
||||
IContainer container;
|
||||
IContainer targetContainer;
|
||||
if ( path.segmentCount() > 1) {
|
||||
path = path.removeLastSegments(1);
|
||||
container = (IContainer) fContainer.findMember(path);
|
||||
targetContainer = (IContainer) container.findMember(path);
|
||||
} else {
|
||||
container = fContainer;
|
||||
targetContainer = container;
|
||||
}
|
||||
IMakeTarget target = MakeCorePlugin.getDefault().getTargetManager().findTarget(container, name);
|
||||
IMakeTarget target = MakeCorePlugin.getDefault().getTargetManager().findTarget(targetContainer, name);
|
||||
if (target != null)
|
||||
dialog.setTarget(target);
|
||||
}
|
||||
|
@ -59,9 +49,9 @@ public class BuildTargetAction extends ActionDelegate implements IObjectActionDe
|
|||
IMakeTarget target = dialog.getTarget();
|
||||
if (target != null) {
|
||||
try {
|
||||
IPath path = target.getContainer().getProjectRelativePath().removeFirstSegments(fContainer.getProjectRelativePath().segmentCount());
|
||||
IPath path = target.getContainer().getProjectRelativePath().removeFirstSegments(container.getProjectRelativePath().segmentCount());
|
||||
path = path.append(target.getName());
|
||||
fContainer.setSessionProperty(
|
||||
container.setSessionProperty(
|
||||
new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"),
|
||||
path.toString());
|
||||
} catch (CoreException e1) {
|
||||
|
@ -71,23 +61,6 @@ public class BuildTargetAction extends ActionDelegate implements IObjectActionDe
|
|||
}
|
||||
}
|
||||
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
fPart = targetPart;
|
||||
}
|
||||
|
||||
public void init(IWorkbenchWindow window) {
|
||||
}
|
||||
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
IStructuredSelection sel = (IStructuredSelection) selection;
|
||||
if (sel.getFirstElement() instanceof ICContainer) {
|
||||
fContainer = (IContainer) ((ICContainer) sel.getFirstElement()).getUnderlyingResource();
|
||||
} else if (sel.getFirstElement() instanceof IContainer) {
|
||||
fContainer = (IContainer) sel.getFirstElement();
|
||||
} else {
|
||||
fContainer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,52 +8,20 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.make.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICContainer;
|
||||
import org.eclipse.cdt.make.ui.dialogs.MakeTargetDialog;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
|
||||
public class CreateTargetAction extends ActionDelegate implements IObjectActionDelegate, IWorkbenchWindowActionDelegate {
|
||||
|
||||
IWorkbenchPart fPart;
|
||||
IContainer fContainer;
|
||||
public class CreateTargetAction extends AbstractTargetAction {
|
||||
|
||||
public void run(IAction action) {
|
||||
if ( fContainer != null ) {
|
||||
if ( getSelectedContainer() != null ) {
|
||||
MakeTargetDialog dialog;
|
||||
try {
|
||||
dialog = new MakeTargetDialog(fPart.getSite().getShell(), fContainer);
|
||||
dialog = new MakeTargetDialog(getShell(), getSelectedContainer());
|
||||
dialog.open();
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
fPart = targetPart;
|
||||
}
|
||||
|
||||
public void init(IWorkbenchWindow window) {
|
||||
}
|
||||
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
if ( selection instanceof IStructuredSelection ) {
|
||||
IStructuredSelection sel = (IStructuredSelection)selection;
|
||||
if ( sel.getFirstElement() instanceof ICContainer ) {
|
||||
fContainer = (IContainer) ((ICContainer)sel.getFirstElement()).getUnderlyingResource();
|
||||
} else if (sel.getFirstElement() instanceof IContainer ) {
|
||||
fContainer = (IContainer)sel.getFirstElement();
|
||||
} else {
|
||||
fContainer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.core.resources.IResourceProxy;
|
|||
import org.eclipse.core.resources.IResourceProxyVisitor;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
@ -92,15 +93,8 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
Vector result = new Vector();
|
||||
try {
|
||||
for (int i = 0; i < project.length; i++) {
|
||||
if (project[i].isAccessible()) {
|
||||
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)) {
|
||||
if (isOldProject(project[i])) {
|
||||
result.add(project[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
|
@ -110,6 +104,18 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
return (IProject[]) result.toArray(new IProject[result.size()]);
|
||||
}
|
||||
|
||||
protected static boolean isOldProject(IProject project) throws CoreException {
|
||||
if (project.isAccessible()) {
|
||||
IProjectDescription desc = project.getDescription();
|
||||
ICommand builder[] = desc.getBuildSpec();
|
||||
for (int j = 0; j < builder.length; j++) {
|
||||
if (builder[j].getBuilderName().equals(MakeCorePlugin.OLD_BUILDER_ID)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static public void run(boolean fork, IRunnableContext context, final IProject[] projects) {
|
||||
try {
|
||||
|
@ -198,7 +204,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
new SubProgressMonitor(monitor, 1));
|
||||
|
||||
// convert .cdtproject
|
||||
CCorePlugin.getDefault().mapCProjectOwner(project[i], MakeCorePlugin.getUniqueIdentifier() + ".make", true);
|
||||
CCorePlugin.getDefault().mapCProjectOwner(project[i], MakeCorePlugin.MAKE_PROJECT_ID, true);
|
||||
// add new nature
|
||||
MakeProjectNature.addNature(project[i], new SubProgressMonitor(monitor, 1));
|
||||
|
||||
|
@ -242,6 +248,20 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
}
|
||||
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
boolean enabled = false;
|
||||
fSelection = selection;
|
||||
if (fSelection instanceof IStructuredSelection) {
|
||||
Object sel = ((IStructuredSelection) fSelection).getFirstElement();
|
||||
if (sel instanceof IAdaptable) {
|
||||
IResource res = (IResource) ((IAdaptable) sel).getAdapter(IResource.class);
|
||||
try {
|
||||
if (res instanceof IProject && isOldProject((IProject) res)) {
|
||||
enabled = true;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
action.setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,15 +18,11 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
|||
*/
|
||||
public class ConvertToMakeProjectWizard extends ConversionWizard {
|
||||
|
||||
private MakeProjectWizardOptionPage optionsPage;
|
||||
private static final String WZ_TITLE = "WizardMakeProjectConversion.title"; //$NON-NLS-1$
|
||||
private static final String WZ_DESC = "WizardMakeProjectConversion.description"; //$NON-NLS-1$
|
||||
private static final String PREFIX = "WizardMakeConversion"; //$NON-NLS-1$
|
||||
private static final String WINDOW_TITLE = "WizardMakeConversion.windowTitle"; //$NON-NLS-1$
|
||||
|
||||
private static final String WZ_SETTINGS_TITLE = "WizardMakeProjectConversionSettings.title"; //$NON-NLS-1$
|
||||
private static final String WZ_SETTINGS_DESC = "WizardMakeProjectConversionSettings.description"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* ConvertToStdMakeConversionWizard Wizard constructor
|
||||
*/
|
||||
|
@ -89,16 +85,18 @@ public class ConvertToMakeProjectWizard extends ConversionWizard {
|
|||
*/
|
||||
public void addPages() {
|
||||
addPage(mainPage = new ConvertToMakeProjectWizardPage(getPrefix()));
|
||||
addPage(optionsPage = new MakeProjectWizardOptionPage(MakeUIPlugin.getResourceString(WZ_SETTINGS_TITLE), MakeUIPlugin.getResourceString(WZ_SETTINGS_DESC)));
|
||||
}
|
||||
|
||||
public String getProjectID() {
|
||||
return MakeCorePlugin.getUniqueIdentifier() + ".make"; //$NON-NLS-1$
|
||||
return MakeCorePlugin.MAKE_PROJECT_ID;
|
||||
}
|
||||
|
||||
protected void doRun(IProgressMonitor monitor) throws CoreException {
|
||||
monitor.beginTask("Converting to Make Project...", 2);
|
||||
try {
|
||||
super.doRun(new SubProgressMonitor(monitor, 1));
|
||||
optionsPage.performApply(new SubProgressMonitor(monitor, 1));
|
||||
} finally {
|
||||
monitor.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,17 @@ package org.eclipse.cdt.make.ui.wizards;
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.make.core.MakeProjectNature;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
import org.eclipse.cdt.ui.wizards.conversion.ConvertProjectWizardPage;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -64,4 +72,24 @@ public class ConvertToMakeProjectWizardPage extends ConvertProjectWizardPage {
|
|||
public boolean isCandidate(IProject project) {
|
||||
return true; // all
|
||||
}
|
||||
|
||||
public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException {
|
||||
monitor.beginTask("Converting Make project...", 3);
|
||||
try {
|
||||
super.convertProject(project, new SubProgressMonitor(monitor, 1), projectID);
|
||||
MakeProjectNature.addNature(project, new SubProgressMonitor(monitor, 1));
|
||||
CCorePlugin.getDefault().mapCProjectOwner(project, projectID, true);
|
||||
} finally {
|
||||
monitor.done();
|
||||
}
|
||||
}
|
||||
|
||||
public void createControl(Composite parent) {
|
||||
super.createControl(parent);
|
||||
IStructuredSelection sel = ((BasicNewResourceWizard)getWizard()).getSelection();
|
||||
if ( sel != null) {
|
||||
tableViewer.setCheckedElements(sel.toArray());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,6 +49,6 @@ public abstract class NewMakeProjectWizard extends NewCProjectWizard {
|
|||
}
|
||||
|
||||
public String getProjectID() {
|
||||
return MakeCorePlugin.getUniqueIdentifier() + ".make"; //$NON-NLS-1$
|
||||
return MakeCorePlugin.MAKE_PROJECT_ID;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue