mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
This commit is contained in:
parent
c7fe5e657a
commit
e34c4afc9a
2 changed files with 94 additions and 9 deletions
|
@ -102,20 +102,89 @@
|
||||||
</filter>
|
</filter>
|
||||||
</objectContribution>
|
</objectContribution>
|
||||||
<objectContribution
|
<objectContribution
|
||||||
objectClass="org.eclipse.core.resources.IContainer"
|
objectClass="org.eclipse.cdt.core.model.ITranslationUnit"
|
||||||
|
adaptable="false"
|
||||||
|
id="org.eclipse.cdt.make.ui.popupMenu.CViewContribution">
|
||||||
|
<action
|
||||||
|
label="%ActionMakeCreateTarget.label"
|
||||||
|
class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
|
||||||
|
menubarPath="buildGroup"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.make.ui.CViewCreateTargetAction">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
label="%ActionMakeBuildTarget.label"
|
||||||
|
class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
|
||||||
|
menubarPath="buildGroup"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.make.ui.CViewBuildTargetAction">
|
||||||
|
</action>
|
||||||
|
<filter
|
||||||
|
name="projectNature"
|
||||||
|
value="org.eclipse.cdt.make.core.makeNature">
|
||||||
|
</filter>
|
||||||
|
</objectContribution>
|
||||||
|
<objectContribution
|
||||||
|
objectClass="org.eclipse.cdt.core.model.IBinary"
|
||||||
|
adaptable="false"
|
||||||
|
id="org.eclipse.cdt.make.ui.popupMenu.CViewContribution">
|
||||||
|
<action
|
||||||
|
label="%ActionMakeCreateTarget.label"
|
||||||
|
class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
|
||||||
|
menubarPath="buildGroup"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.make.ui.CViewCreateTargetAction">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
label="%ActionMakeBuildTarget.label"
|
||||||
|
class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
|
||||||
|
menubarPath="buildGroup"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.make.ui.CViewBuildTargetAction">
|
||||||
|
</action>
|
||||||
|
<filter
|
||||||
|
name="projectNature"
|
||||||
|
value="org.eclipse.cdt.make.core.makeNature">
|
||||||
|
</filter>
|
||||||
|
</objectContribution>
|
||||||
|
<objectContribution
|
||||||
|
objectClass="org.eclipse.cdt.core.model.IArchive"
|
||||||
|
adaptable="false"
|
||||||
|
id="org.eclipse.cdt.make.ui.popupMenu.CViewContribution">
|
||||||
|
<action
|
||||||
|
label="%ActionMakeCreateTarget.label"
|
||||||
|
class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
|
||||||
|
menubarPath="buildGroup"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.make.ui.CViewCreateTargetAction">
|
||||||
|
</action>
|
||||||
|
<action
|
||||||
|
label="%ActionMakeBuildTarget.label"
|
||||||
|
class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
|
||||||
|
menubarPath="buildGroup"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.make.ui.CViewBuildTargetAction">
|
||||||
|
</action>
|
||||||
|
<filter
|
||||||
|
name="projectNature"
|
||||||
|
value="org.eclipse.cdt.make.core.makeNature">
|
||||||
|
</filter>
|
||||||
|
</objectContribution>
|
||||||
|
<objectContribution
|
||||||
|
objectClass="org.eclipse.core.resources.IResource"
|
||||||
adaptable="false"
|
adaptable="false"
|
||||||
id="org.eclipse.cdt.make.ui.popupMenu.NavigatorContribution">
|
id="org.eclipse.cdt.make.ui.popupMenu.NavigatorContribution">
|
||||||
<action
|
<action
|
||||||
label="%ActionMakeBuildTarget.label"
|
label="%ActionMakeBuildTarget.label"
|
||||||
class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
|
class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
|
||||||
menubarPath="additions"
|
menubarPath="buildGroup"
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
id="org.eclipse.cdt.make.ui.NavigatorBuildTargetAction">
|
id="org.eclipse.cdt.make.ui.NavigatorBuildTargetAction">
|
||||||
</action>
|
</action>
|
||||||
<action
|
<action
|
||||||
label="%ActionMakeCreateTarget.label"
|
label="%ActionMakeCreateTarget.label"
|
||||||
class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
|
class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
|
||||||
menubarPath="additions"
|
menubarPath="buildGroup"
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
id="org.eclipse.cdt.make.ui.CViewCreateTargetAction">
|
id="org.eclipse.cdt.make.ui.CViewCreateTargetAction">
|
||||||
</action>
|
</action>
|
||||||
|
@ -287,7 +356,9 @@
|
||||||
</action>
|
</action>
|
||||||
</actionSet>
|
</actionSet>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
|
||||||
|
<!-- Makefile Editor comment out for CDT 1.2 -->
|
||||||
|
<!--extension
|
||||||
id="org.eclipse.cdt.make.editor"
|
id="org.eclipse.cdt.make.editor"
|
||||||
name="MakefileEditor"
|
name="MakefileEditor"
|
||||||
point="org.eclipse.ui.editors">
|
point="org.eclipse.ui.editors">
|
||||||
|
@ -299,7 +370,7 @@
|
||||||
class="org.eclipse.cdt.make.internal.ui.editor.MakefileEditor"
|
class="org.eclipse.cdt.make.internal.ui.editor.MakefileEditor"
|
||||||
id="org.eclipse.cdt.make.editor">
|
id="org.eclipse.cdt.make.editor">
|
||||||
</editor>
|
</editor>
|
||||||
</extension>
|
</extension -->
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.startup">
|
point="org.eclipse.ui.startup">
|
||||||
<startup>
|
<startup>
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
package org.eclipse.cdt.make.ui.actions;
|
package org.eclipse.cdt.make.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICContainer;
|
import org.eclipse.cdt.core.model.ICContainer;
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
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.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
@ -54,10 +56,22 @@ public abstract class AbstractTargetAction
|
||||||
boolean enabled = false;
|
boolean enabled = false;
|
||||||
if (selection instanceof IStructuredSelection) {
|
if (selection instanceof IStructuredSelection) {
|
||||||
IStructuredSelection sel = (IStructuredSelection) selection;
|
IStructuredSelection sel = (IStructuredSelection) selection;
|
||||||
if (sel.getFirstElement() instanceof ICContainer) {
|
Object obj = sel.getFirstElement();
|
||||||
fContainer = (IContainer) ((ICContainer) sel.getFirstElement()).getUnderlyingResource();
|
if (obj instanceof ICElement) {
|
||||||
} else if (sel.getFirstElement() instanceof IContainer) {
|
if ( obj instanceof ICContainer) {
|
||||||
fContainer = (IContainer) sel.getFirstElement();
|
fContainer = (IContainer) ((ICContainer) obj).getUnderlyingResource();
|
||||||
|
} else {
|
||||||
|
obj = ((ICElement)obj).getResource();
|
||||||
|
if ( obj != null) {
|
||||||
|
fContainer = ((IResource)obj).getParent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (obj instanceof IResource) {
|
||||||
|
if (obj instanceof IContainer) {
|
||||||
|
fContainer = (IContainer) obj;
|
||||||
|
} else {
|
||||||
|
fContainer = ((IResource)obj).getParent();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fContainer = null;
|
fContainer = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue