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>
|
||||
</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"
|
||||
id="org.eclipse.cdt.make.ui.popupMenu.NavigatorContribution">
|
||||
<action
|
||||
label="%ActionMakeBuildTarget.label"
|
||||
class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
|
||||
menubarPath="additions"
|
||||
menubarPath="buildGroup"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.make.ui.NavigatorBuildTargetAction">
|
||||
</action>
|
||||
<action
|
||||
label="%ActionMakeCreateTarget.label"
|
||||
class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
|
||||
menubarPath="additions"
|
||||
menubarPath="buildGroup"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.make.ui.CViewCreateTargetAction">
|
||||
</action>
|
||||
|
@ -287,7 +356,9 @@
|
|||
</action>
|
||||
</actionSet>
|
||||
</extension>
|
||||
<extension
|
||||
|
||||
<!-- Makefile Editor comment out for CDT 1.2 -->
|
||||
<!--extension
|
||||
id="org.eclipse.cdt.make.editor"
|
||||
name="MakefileEditor"
|
||||
point="org.eclipse.ui.editors">
|
||||
|
@ -299,7 +370,7 @@
|
|||
class="org.eclipse.cdt.make.internal.ui.editor.MakefileEditor"
|
||||
id="org.eclipse.cdt.make.editor">
|
||||
</editor>
|
||||
</extension>
|
||||
</extension -->
|
||||
<extension
|
||||
point="org.eclipse.ui.startup">
|
||||
<startup>
|
||||
|
|
|
@ -9,9 +9,11 @@
|
|||
package org.eclipse.cdt.make.ui.actions;
|
||||
|
||||
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.internal.ui.MakeUIPlugin;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -54,10 +56,22 @@ public abstract class AbstractTargetAction
|
|||
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();
|
||||
Object obj = sel.getFirstElement();
|
||||
if (obj instanceof ICElement) {
|
||||
if ( obj instanceof ICContainer) {
|
||||
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 {
|
||||
fContainer = null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue