1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-17 05:55:22 +02:00

[222470] Enable default compile command and user actions in org.eclipse.rse.useractions plugin

This commit is contained in:
Xuan Chen 2008-03-14 04:09:22 +00:00
parent d2c0d5f7d9
commit fa114bd855
6 changed files with 118 additions and 48 deletions

View file

@ -20,3 +20,6 @@ providerName = Eclipse.org
PropertyPage.TeamViewUserActionNode = User Action Information PropertyPage.TeamViewUserActionNode = User Action Information
PropertyPage.TeamViewCompileTypeNode = Compile Type Information PropertyPage.TeamViewCompileTypeNode = Compile Type Information
PropertyPage.TeamViewCompileCommandNode = Compile Command Information PropertyPage.TeamViewCompileCommandNode = Compile Command Information
DynamicLabel.CompileActionNode = Compile
DynamicLabel.UserActionNode = User Action

View file

@ -39,5 +39,24 @@
</page> </page>
</extension> </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> </plugin>

View file

@ -155,12 +155,16 @@ public class SystemWorkWithUDAsAction extends SystemBaseDialogAction {
//System.out.println("First selection: "+element); //System.out.println("First selection: "+element);
if ((subsystem == null) && (element instanceof ISubSystem)) { if ((subsystem == null) && (element instanceof ISubSystem)) {
subsystem = (ISubSystem) element; 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; SystemTeamViewSubSystemConfigurationNode ssfNode = (SystemTeamViewSubSystemConfigurationNode) element;
subsystemFactory = ssfNode.getSubSystemConfiguration(); subsystemFactory = ssfNode.getSubSystemConfiguration();
profile = ssfNode.getProfile(); profile = ssfNode.getProfile();
//System.out.println("Profile is: "+profile); //System.out.println("Profile is: "+profile);
} }
*/
SystemWorkWithUDAsDialog dlg = null; SystemWorkWithUDAsDialog dlg = null;
if (subsystem != null) if (subsystem != null)
dlg = new SystemWorkWithUDAsDialog(parent, subsystem, udaActionSubsystem); dlg = new SystemWorkWithUDAsDialog(parent, subsystem, udaActionSubsystem);

View file

@ -21,6 +21,7 @@ import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; 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.SystemCompileCommand;
import org.eclipse.rse.internal.useractions.ui.compile.SystemCompileManager; 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.SystemCompileProfile;
@ -68,10 +69,29 @@ public class SystemDynamicCompileMenu extends CompoundContributionItem
} }
Shell shell = SystemBasePlugin.getActiveWorkbenchShell(); 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++) for (int idx = 0; idx < activeProfiles.length; idx++)
{ {
String srcType = null; String srcType = null;
ISystemRemoteElementAdapter rmtAdapter = SystemAdapterHelpers.getRemoteAdapter(firstSelection);
if (rmtAdapter != null) { if (rmtAdapter != null) {
srcType = rmtAdapter.getRemoteSourceType(firstSelection); srcType = rmtAdapter.getRemoteSourceType(firstSelection);
if (srcType == null) if (srcType == null)
@ -79,21 +99,9 @@ public class SystemDynamicCompileMenu extends CompoundContributionItem
else if (srcType.equals("")) //$NON-NLS-1$ else if (srcType.equals("")) //$NON-NLS-1$
srcType = "blank"; //$NON-NLS-1$ srcType = "blank"; //$NON-NLS-1$
} }
ISubSystem subsystem = rmtAdapter.getSubSystem(firstSelection);
ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration();
SystemCompileManager compileManager = null; if (null != compileManager)
{
if (firstSelection instanceof IAdaptable) {
ISystemCompileManagerAdapter adapter = (ISystemCompileManagerAdapter)((IAdaptable)firstSelection).getAdapter(ISystemCompileManagerAdapter.class);
if (null != adapter)
{
compileManager = adapter.getSystemCompileManager(ssc);
}
}
if (null != compileManager)
{
SystemCompileManager thisCompileManager = compileManager; SystemCompileManager thisCompileManager = compileManager;
SystemCompileProfile compileProfile = thisCompileManager.getCompileProfile(activeProfiles[idx]); SystemCompileProfile compileProfile = thisCompileManager.getCompileProfile(activeProfiles[idx]);
// compileProfile.addContributions(firstSelection); // compileProfile.addContributions(firstSelection);
@ -120,7 +128,7 @@ public class SystemDynamicCompileMenu extends CompoundContributionItem
// add Work With Commands... action // add Work With Commands... action
// Here's where you would dynamically generate your list // 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); workWithCompileCommandAction.setSelection(selection);
TestContribution testContribution = new TestContribution(workWithCompileCommandAction); TestContribution testContribution = new TestContribution(workWithCompileCommandAction);
returnedItemList.add(testContribution); returnedItemList.add(testContribution);

View file

@ -21,11 +21,13 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode; import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
import org.eclipse.rse.internal.useractions.IUserActionsImageIds; 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.SystemCompileManager;
import org.eclipse.rse.internal.useractions.ui.compile.SystemCompileProfile; 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.SystemWorkWithCompileCommandsDialog;
import org.eclipse.rse.internal.useractions.ui.compile.teamview.SystemTeamViewCompileTypeNode; 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.SystemUDAResources;
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDActionSubsystem;
import org.eclipse.rse.ui.ISystemContextMenuConstants; import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.actions.SystemBaseDialogAction; 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 * The action that displays the Work With -> Compile Commands menu item
*/ */
public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction { public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction {
private ISubSystem subsystem = null;
private ISubSystemConfiguration subsystemFactory = null;
private ISystemProfile profile = null;
private SystemCompileManager compileManager = null;
/** /**
* Constructor * Constructor
* @param shell The Shell of the parent UI for this dialog * @param shell The Shell of the parent UI for this dialog
@ -56,6 +64,19 @@ public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction
setAvailableOffline(true); 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 * Reset between runs
*/ */
@ -94,52 +115,60 @@ public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction
protected Dialog createDialog(Shell shell) { protected Dialog createDialog(Shell shell) {
Object inputObject = getFirstSelection(); Object inputObject = getFirstSelection();
boolean caseSensitive = false; boolean caseSensitive = false;
ISubSystem subsystem = null; if (null == subsystem)
ISubSystemConfiguration ssf = null; {
ISystemProfile currSystemProfile = null; if (inputObject instanceof ISubSystem)
if (inputObject instanceof ISubSystem) subsystem = (ISubSystem) inputObject;
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); else if (inputObject instanceof SystemTeamViewCompileTypeNode) {
ssf = typeNode.getParentSubSystemFactory().getSubSystemConfiguration(); SystemTeamViewCompileTypeNode typeNode = ((SystemTeamViewCompileTypeNode) inputObject);
currSystemProfile = typeNode.getProfile(); subsystemFactory = typeNode.getParentSubSystemFactory().getSubSystemConfiguration();
} else if (inputObject instanceof SystemTeamViewSubSystemConfigurationNode) { profile = typeNode.getProfile();
ssf = ((SystemTeamViewSubSystemConfigurationNode) inputObject).getSubSystemConfiguration(); } else if (inputObject instanceof SystemTeamViewSubSystemConfigurationNode) {
currSystemProfile = ((SystemTeamViewSubSystemConfigurationNode) inputObject).getProfile(); subsystemFactory = ((SystemTeamViewSubSystemConfigurationNode) inputObject).getSubSystemConfiguration();
} else { profile = ((SystemTeamViewSubSystemConfigurationNode) inputObject).getProfile();
ISystemRemoteElementAdapter rmtAdapter = SystemAdapterHelpers.getRemoteAdapter(inputObject); }
if (rmtAdapter != null) subsystem = rmtAdapter.getSubSystem(inputObject); */
else {
ISystemRemoteElementAdapter rmtAdapter = SystemAdapterHelpers.getRemoteAdapter(inputObject);
if (rmtAdapter != null) subsystem = rmtAdapter.getSubSystem(inputObject);
}
} }
SystemCompileProfile currProfile = null; SystemCompileProfile currProfile = null;
SystemCompileProfile[] currProfiles = null; SystemCompileProfile[] currProfiles = null;
SystemCompileManager compileManager = null;
if (subsystem != null) { if (subsystem != null) {
if (ssf == null) ssf = subsystem.getSubSystemConfiguration(); if (subsystemFactory == null) subsystemFactory = subsystem.getSubSystemConfiguration();
if (currSystemProfile == null) currSystemProfile = subsystem.getSystemProfile(); if (profile == null) profile = subsystem.getSystemProfile();
} }
if (ssf != null) {
ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration();
if (null == compileManager)
{
if (inputObject instanceof IAdaptable) { if (inputObject instanceof IAdaptable) {
ISystemCompileManagerAdapter adapter = (ISystemCompileManagerAdapter)((IAdaptable)inputObject).getAdapter(ISystemCompileManagerAdapter.class); ISystemCompileManagerAdapter adapter = (ISystemCompileManagerAdapter)((IAdaptable)inputObject).getAdapter(ISystemCompileManagerAdapter.class);
if (null != adapter) if (null != adapter)
{ {
compileManager = adapter.getSystemCompileManager(ssc); compileManager = adapter.getSystemCompileManager(subsystemFactory);
} }
} }
}
if (null != compileManager) if (null == compileManager)
{ {
if (currSystemProfile != null) compileManager = new UniversalCompileManager();
compileManager.setSubSystemFactory(subsystemFactory);
}
if (null != compileManager)
{
if (profile != null)
{ {
currProfile = compileManager.getCompileProfile(currSystemProfile); currProfile = compileManager.getCompileProfile(profile);
currProfiles = compileManager.getAllCompileProfiles(); currProfiles = compileManager.getAllCompileProfiles();
} }
caseSensitive = ssf.isCaseSensitive(); caseSensitive = subsystemFactory.isCaseSensitive();
SystemWorkWithCompileCommandsDialog dlg = new SystemWorkWithCompileCommandsDialog(shell, compileManager, currProfile); SystemWorkWithCompileCommandsDialog dlg = new SystemWorkWithCompileCommandsDialog(shell, compileManager, currProfile);
/* FIXME - currProfiles cannot be null since above stuff was commented out /* FIXME - currProfiles cannot be null since above stuff was commented out
@ -155,7 +184,6 @@ public class SystemWorkWithCompileCommandsAction extends SystemBaseDialogAction
dlg.setSupportsAddSrcTypeButton(false); dlg.setSupportsAddSrcTypeButton(false);
} }
return dlg; return dlg;
}
} }
return null; return null;
} }

View file

@ -21,6 +21,7 @@ import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; 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.SystemUDAResources;
import org.eclipse.rse.internal.useractions.ui.uda.SystemUDActionSubsystem; import org.eclipse.rse.internal.useractions.ui.uda.SystemUDActionSubsystem;
import org.eclipse.rse.internal.useractions.ui.uda.actions.SystemWorkWithUDAsAction; 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(); Shell shell = SystemBasePlugin.getActiveWorkbenchShell();
for (int idx = 0; idx < activeProfiles.length; idx++) for (int idx = 0; idx < activeProfiles.length; idx++)
{ {