mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-16 05:25:21 +02:00
[222470] Enable default compile command and user actions in org.eclipse.rse.useractions plugin
This commit is contained in:
parent
d2c0d5f7d9
commit
fa114bd855
6 changed files with 118 additions and 48 deletions
|
@ -20,3 +20,6 @@ providerName = Eclipse.org
|
|||
PropertyPage.TeamViewUserActionNode = User Action Information
|
||||
PropertyPage.TeamViewCompileTypeNode = Compile Type Information
|
||||
PropertyPage.TeamViewCompileCommandNode = Compile Command Information
|
||||
|
||||
DynamicLabel.CompileActionNode = Compile
|
||||
DynamicLabel.UserActionNode = User Action
|
||||
|
|
|
@ -39,5 +39,24 @@
|
|||
</page>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.ui.menus">
|
||||
<menuContribution locationURI="popup:org.eclipse.rse.ui.view.systemView">
|
||||
<menu id="org.eclipse.rse.ui.useractions.compile.menu"
|
||||
label="%DynamicLabel.CompileActionNode"
|
||||
mnemonic="useractions.dynamiccompilemenu.mnemonic">
|
||||
<dynamic class="org.eclipse.rse.useractions.ui.compile.SystemDynamicCompileMenu"
|
||||
id="org.eclipse.ui.rse.ui.views.dynamiccompilemenu">
|
||||
</dynamic>
|
||||
</menu>
|
||||
<menu id="org.eclipse.rse.ui.useractions.useraction.menu"
|
||||
label="%DynamicLabel.UserActionNode"
|
||||
mnemonic="useractions.dynamicuseractionmenu.mnemonic">
|
||||
<dynamic class="org.eclipse.rse.useractions.ui.uda.SystemDynamicUserActionMenu"
|
||||
id="org.eclipse.ui.rse.ui.views.dynamicuseractionmenu">
|
||||
</dynamic>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -155,12 +155,16 @@ public class SystemWorkWithUDAsAction extends SystemBaseDialogAction {
|
|||
//System.out.println("First selection: "+element);
|
||||
if ((subsystem == null) && (element instanceof ISubSystem)) {
|
||||
subsystem = (ISubSystem) element;
|
||||
} else if ((subsystemFactory == null) && (element instanceof SystemTeamViewSubSystemConfigurationNode)) {
|
||||
}
|
||||
//Don't think we need to support invoking Work With User Action dialog from Team view
|
||||
/*
|
||||
else if ((subsystemFactory == null) && (element instanceof SystemTeamViewSubSystemConfigurationNode)) {
|
||||
SystemTeamViewSubSystemConfigurationNode ssfNode = (SystemTeamViewSubSystemConfigurationNode) element;
|
||||
subsystemFactory = ssfNode.getSubSystemConfiguration();
|
||||
profile = ssfNode.getProfile();
|
||||
//System.out.println("Profile is: "+profile);
|
||||
}
|
||||
*/
|
||||
SystemWorkWithUDAsDialog dlg = null;
|
||||
if (subsystem != null)
|
||||
dlg = new SystemWorkWithUDAsDialog(parent, subsystem, udaActionSubsystem);
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.rse.core.RSECorePlugin;
|
|||
import org.eclipse.rse.core.model.ISystemProfile;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.internal.useractions.files.compile.UniversalCompileManager;
|
||||
import org.eclipse.rse.internal.useractions.ui.compile.SystemCompileCommand;
|
||||
import org.eclipse.rse.internal.useractions.ui.compile.SystemCompileManager;
|
||||
import org.eclipse.rse.internal.useractions.ui.compile.SystemCompileProfile;
|
||||
|
@ -68,10 +69,29 @@ public class SystemDynamicCompileMenu extends CompoundContributionItem
|
|||
}
|
||||
Shell shell = SystemBasePlugin.getActiveWorkbenchShell();
|
||||
|
||||
ISystemRemoteElementAdapter rmtAdapter = SystemAdapterHelpers.getRemoteAdapter(firstSelection);
|
||||
ISubSystem subsystem = rmtAdapter.getSubSystem(firstSelection);
|
||||
ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration();
|
||||
|
||||
SystemCompileManager compileManager = null;
|
||||
|
||||
if (firstSelection instanceof IAdaptable) {
|
||||
ISystemCompileManagerAdapter adapter = (ISystemCompileManagerAdapter)((IAdaptable)firstSelection).getAdapter(ISystemCompileManagerAdapter.class);
|
||||
if (null != adapter)
|
||||
{
|
||||
compileManager = adapter.getSystemCompileManager(ssc);
|
||||
}
|
||||
}
|
||||
|
||||
if (null == compileManager)
|
||||
{
|
||||
compileManager = new UniversalCompileManager();
|
||||
compileManager.setSubSystemFactory(ssc);
|
||||
}
|
||||
|
||||
for (int idx = 0; idx < activeProfiles.length; idx++)
|
||||
{
|
||||
String srcType = null;
|
||||
ISystemRemoteElementAdapter rmtAdapter = SystemAdapterHelpers.getRemoteAdapter(firstSelection);
|
||||
if (rmtAdapter != null) {
|
||||
srcType = rmtAdapter.getRemoteSourceType(firstSelection);
|
||||
if (srcType == null)
|
||||
|
@ -79,21 +99,9 @@ public class SystemDynamicCompileMenu extends CompoundContributionItem
|
|||
else if (srcType.equals("")) //$NON-NLS-1$
|
||||
srcType = "blank"; //$NON-NLS-1$
|
||||
}
|
||||
ISubSystem subsystem = rmtAdapter.getSubSystem(firstSelection);
|
||||
ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration();
|
||||
|
||||
SystemCompileManager compileManager = null;
|
||||
|
||||
if (firstSelection instanceof IAdaptable) {
|
||||
ISystemCompileManagerAdapter adapter = (ISystemCompileManagerAdapter)((IAdaptable)firstSelection).getAdapter(ISystemCompileManagerAdapter.class);
|
||||
if (null != adapter)
|
||||
{
|
||||
compileManager = adapter.getSystemCompileManager(ssc);
|
||||
}
|
||||
}
|
||||
|
||||
if (null != compileManager)
|
||||
{
|
||||
if (null != compileManager)
|
||||
{
|
||||
SystemCompileManager thisCompileManager = compileManager;
|
||||
SystemCompileProfile compileProfile = thisCompileManager.getCompileProfile(activeProfiles[idx]);
|
||||
// compileProfile.addContributions(firstSelection);
|
||||
|
@ -120,7 +128,7 @@ public class SystemDynamicCompileMenu extends CompoundContributionItem
|
|||
// add Work With Commands... action
|
||||
|
||||
// Here's where you would dynamically generate your list
|
||||
SystemWorkWithCompileCommandsAction workWithCompileCommandAction = new SystemWorkWithCompileCommandsAction(shell, true);
|
||||
SystemWorkWithCompileCommandsAction workWithCompileCommandAction = new SystemWorkWithCompileCommandsAction(shell, true, subsystem, compileManager);
|
||||
workWithCompileCommandAction.setSelection(selection);
|
||||
TestContribution testContribution = new TestContribution(workWithCompileCommandAction);
|
||||
returnedItemList.add(testContribution);
|
||||
|
|
|
@ -21,11 +21,13 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
|
|||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
|
||||
import org.eclipse.rse.internal.useractions.IUserActionsImageIds;
|
||||
import org.eclipse.rse.internal.useractions.files.compile.UniversalCompileManager;
|
||||
import org.eclipse.rse.internal.useractions.ui.compile.SystemCompileManager;
|
||||
import org.eclipse.rse.internal.useractions.ui.compile.SystemCompileProfile;
|
||||
import org.eclipse.rse.internal.useractions.ui.compile.SystemWorkWithCompileCommandsDialog;
|
||||
import org.eclipse.rse.internal.useractions.ui.compile.teamview.SystemTeamViewCompileTypeNode;
|
||||
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDAResources;
|
||||
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDActionSubsystem;
|
||||
import org.eclipse.rse.ui.ISystemContextMenuConstants;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
|
||||
|
@ -38,6 +40,12 @@ import org.eclipse.swt.widgets.Shell;
|
|||
* The action that displays the Work With -> Compile Commands menu item
|
||||
*/
|
||||
public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction {
|
||||
|
||||
private ISubSystem subsystem = null;
|
||||
private ISubSystemConfiguration subsystemFactory = null;
|
||||
private ISystemProfile profile = null;
|
||||
private SystemCompileManager compileManager = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param shell The Shell of the parent UI for this dialog
|
||||
|
@ -55,6 +63,19 @@ public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction
|
|||
setHelp(RSEUIPlugin.HELPPREFIX + "actnwwcc"); //$NON-NLS-1$
|
||||
setAvailableOffline(true);
|
||||
}
|
||||
|
||||
public SystemWorkWithCompileCommandsAction(Shell shell, boolean fromCascadingCompileAction, ISubSystem subSystem, SystemCompileManager compileManager)
|
||||
{
|
||||
this(shell, fromCascadingCompileAction);
|
||||
this.subsystem = subSystem;
|
||||
this.compileManager = compileManager;
|
||||
if (null != subSystem)
|
||||
{
|
||||
subsystemFactory = subsystem.getSubSystemConfiguration();
|
||||
profile = subSystem.getSystemProfile();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset between runs
|
||||
|
@ -94,52 +115,60 @@ public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction
|
|||
protected Dialog createDialog(Shell shell) {
|
||||
Object inputObject = getFirstSelection();
|
||||
boolean caseSensitive = false;
|
||||
ISubSystem subsystem = null;
|
||||
ISubSystemConfiguration ssf = null;
|
||||
ISystemProfile currSystemProfile = null;
|
||||
if (inputObject instanceof ISubSystem)
|
||||
subsystem = (ISubSystem) inputObject;
|
||||
else if (inputObject instanceof SystemTeamViewCompileTypeNode) {
|
||||
SystemTeamViewCompileTypeNode typeNode = ((SystemTeamViewCompileTypeNode) inputObject);
|
||||
ssf = typeNode.getParentSubSystemFactory().getSubSystemConfiguration();
|
||||
currSystemProfile = typeNode.getProfile();
|
||||
} else if (inputObject instanceof SystemTeamViewSubSystemConfigurationNode) {
|
||||
ssf = ((SystemTeamViewSubSystemConfigurationNode) inputObject).getSubSystemConfiguration();
|
||||
currSystemProfile = ((SystemTeamViewSubSystemConfigurationNode) inputObject).getProfile();
|
||||
} else {
|
||||
ISystemRemoteElementAdapter rmtAdapter = SystemAdapterHelpers.getRemoteAdapter(inputObject);
|
||||
if (rmtAdapter != null) subsystem = rmtAdapter.getSubSystem(inputObject);
|
||||
if (null == subsystem)
|
||||
{
|
||||
if (inputObject instanceof ISubSystem)
|
||||
subsystem = (ISubSystem) inputObject;
|
||||
//Don't think we need to support invoking this diaglog from Team view.
|
||||
/*
|
||||
else if (inputObject instanceof SystemTeamViewCompileTypeNode) {
|
||||
SystemTeamViewCompileTypeNode typeNode = ((SystemTeamViewCompileTypeNode) inputObject);
|
||||
subsystemFactory = typeNode.getParentSubSystemFactory().getSubSystemConfiguration();
|
||||
profile = typeNode.getProfile();
|
||||
} else if (inputObject instanceof SystemTeamViewSubSystemConfigurationNode) {
|
||||
subsystemFactory = ((SystemTeamViewSubSystemConfigurationNode) inputObject).getSubSystemConfiguration();
|
||||
profile = ((SystemTeamViewSubSystemConfigurationNode) inputObject).getProfile();
|
||||
}
|
||||
*/
|
||||
else {
|
||||
ISystemRemoteElementAdapter rmtAdapter = SystemAdapterHelpers.getRemoteAdapter(inputObject);
|
||||
if (rmtAdapter != null) subsystem = rmtAdapter.getSubSystem(inputObject);
|
||||
}
|
||||
}
|
||||
SystemCompileProfile currProfile = null;
|
||||
SystemCompileProfile[] currProfiles = null;
|
||||
SystemCompileManager compileManager = null;
|
||||
|
||||
if (subsystem != null) {
|
||||
if (ssf == null) ssf = subsystem.getSubSystemConfiguration();
|
||||
if (currSystemProfile == null) currSystemProfile = subsystem.getSystemProfile();
|
||||
if (subsystemFactory == null) subsystemFactory = subsystem.getSubSystemConfiguration();
|
||||
if (profile == null) profile = subsystem.getSystemProfile();
|
||||
}
|
||||
if (ssf != null) {
|
||||
|
||||
ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration();
|
||||
|
||||
|
||||
|
||||
|
||||
if (null == compileManager)
|
||||
{
|
||||
if (inputObject instanceof IAdaptable) {
|
||||
ISystemCompileManagerAdapter adapter = (ISystemCompileManagerAdapter)((IAdaptable)inputObject).getAdapter(ISystemCompileManagerAdapter.class);
|
||||
if (null != adapter)
|
||||
{
|
||||
compileManager = adapter.getSystemCompileManager(ssc);
|
||||
compileManager = adapter.getSystemCompileManager(subsystemFactory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null != compileManager)
|
||||
{
|
||||
if (currSystemProfile != null)
|
||||
if (null == compileManager)
|
||||
{
|
||||
compileManager = new UniversalCompileManager();
|
||||
compileManager.setSubSystemFactory(subsystemFactory);
|
||||
}
|
||||
|
||||
if (null != compileManager)
|
||||
{
|
||||
if (profile != null)
|
||||
{
|
||||
currProfile = compileManager.getCompileProfile(currSystemProfile);
|
||||
currProfile = compileManager.getCompileProfile(profile);
|
||||
currProfiles = compileManager.getAllCompileProfiles();
|
||||
}
|
||||
|
||||
caseSensitive = ssf.isCaseSensitive();
|
||||
caseSensitive = subsystemFactory.isCaseSensitive();
|
||||
|
||||
SystemWorkWithCompileCommandsDialog dlg = new SystemWorkWithCompileCommandsDialog(shell, compileManager, currProfile);
|
||||
/* FIXME - currProfiles cannot be null since above stuff was commented out
|
||||
|
@ -155,7 +184,6 @@ public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction
|
|||
dlg.setSupportsAddSrcTypeButton(false);
|
||||
}
|
||||
return dlg;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.rse.core.RSECorePlugin;
|
|||
import org.eclipse.rse.core.model.ISystemProfile;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.internal.useractions.files.uda.UDActionSubsystemUniversalFiles;
|
||||
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDAResources;
|
||||
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDActionSubsystem;
|
||||
import org.eclipse.rse.internal.useractions.ui.uda.actions.SystemWorkWithUDAsAction;
|
||||
|
@ -81,6 +82,13 @@ public class SystemDynamicUserActionMenu extends CompoundContributionItem
|
|||
}
|
||||
}
|
||||
|
||||
if (null == systemUDActionSubsystem)
|
||||
{
|
||||
systemUDActionSubsystem = new UDActionSubsystemUniversalFiles();
|
||||
systemUDActionSubsystem.setSubSystemFactory(ssc);
|
||||
systemUDActionSubsystem.setSubsystem(subsystem);
|
||||
}
|
||||
|
||||
Shell shell = SystemBasePlugin.getActiveWorkbenchShell();
|
||||
for (int idx = 0; idx < activeProfiles.length; idx++)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue