mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-09 18:15:23 +02:00
[fix] [161195] Properties action menu contribution is handled as all other menu contributions and can be suppressed via ISystemViewElementAdapter now
This commit is contained in:
parent
d546610333
commit
b122732f45
17 changed files with 72 additions and 25 deletions
|
@ -189,6 +189,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
||||||
protected SystemCommonRenameAction renameAction; // for common rename menu item
|
protected SystemCommonRenameAction renameAction; // for common rename menu item
|
||||||
protected SystemCommonSelectAllAction selectAllAction; // for common Ctrl+A select-all
|
protected SystemCommonSelectAllAction selectAllAction; // for common Ctrl+A select-all
|
||||||
// special flags needed when building popup menu, set after examining selections
|
// special flags needed when building popup menu, set after examining selections
|
||||||
|
protected boolean selectionShowPropertiesAction;
|
||||||
protected boolean selectionShowRefreshAction;
|
protected boolean selectionShowRefreshAction;
|
||||||
protected boolean selectionShowOpenViewActions;
|
protected boolean selectionShowOpenViewActions;
|
||||||
protected boolean selectionShowGenericShowInTableAction;
|
protected boolean selectionShowGenericShowInTableAction;
|
||||||
|
@ -873,19 +874,14 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
||||||
menu.add(new Separator());
|
menu.add(new Separator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PROPERTIES ACTION...
|
// PROPERTIES ACTION...
|
||||||
// This is supplied by the system, so we pretty much get it for free. It finds the
|
// This is supplied by the system, so we pretty much get it for free. It finds the
|
||||||
// registered propertyPages extension points registered for the selected object's class type.
|
// registered propertyPages extension points registered for the selected object's class type.
|
||||||
//propertyDialogAction.selectionChanged(selection);
|
//propertyDialogAction.selectionChanged(selection);
|
||||||
|
if (showProperties()) {
|
||||||
PropertyDialogAction pdAction = getPropertyDialogAction();
|
PropertyDialogAction pdAction = getPropertyDialogAction();
|
||||||
|
if (pdAction.isApplicableForSelection()) menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
|
||||||
if (pdAction.isApplicableForSelection()) menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
|
}
|
||||||
|
|
||||||
|
|
||||||
// GO INTO ACTION...
|
// GO INTO ACTION...
|
||||||
// OPEN IN NEW WINDOW ACTION...
|
// OPEN IN NEW WINDOW ACTION...
|
||||||
|
@ -4189,6 +4185,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
||||||
|
|
||||||
|
|
||||||
// initial these variables to true. Then if set to false even once, leave as false always...
|
// initial these variables to true. Then if set to false even once, leave as false always...
|
||||||
|
selectionShowPropertiesAction = true;
|
||||||
selectionShowRefreshAction = true;
|
selectionShowRefreshAction = true;
|
||||||
selectionShowOpenViewActions = true;
|
selectionShowOpenViewActions = true;
|
||||||
selectionShowGenericShowInTableAction = true;
|
selectionShowGenericShowInTableAction = true;
|
||||||
|
@ -4210,6 +4207,8 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
||||||
ISystemViewElementAdapter adapter = getViewAdapter(element);
|
ISystemViewElementAdapter adapter = getViewAdapter(element);
|
||||||
if (adapter == null) continue;
|
if (adapter == null) continue;
|
||||||
|
|
||||||
|
if (selectionShowPropertiesAction) selectionShowPropertiesAction = adapter.showProperties(element);
|
||||||
|
|
||||||
if (selectionShowRefreshAction) selectionShowRefreshAction = adapter.showRefresh(element);
|
if (selectionShowRefreshAction) selectionShowRefreshAction = adapter.showRefresh(element);
|
||||||
|
|
||||||
if (selectionShowOpenViewActions) selectionShowOpenViewActions = adapter.showOpenViewActions(element);
|
if (selectionShowOpenViewActions) selectionShowOpenViewActions = adapter.showOpenViewActions(element);
|
||||||
|
@ -4256,6 +4255,14 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decides whether to even show the properties menu item.
|
||||||
|
* Assumes scanSelections() has already been called
|
||||||
|
*/
|
||||||
|
protected boolean showProperties() {
|
||||||
|
return selectionShowPropertiesAction;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decides whether to even show the refresh menu item.
|
* Decides whether to even show the refresh menu item.
|
||||||
* Assumes scanSelections() has already been called
|
* Assumes scanSelections() has already been called
|
||||||
|
|
|
@ -59,6 +59,7 @@ import org.eclipse.rse.ui.view.ISystemPropertyConstants;
|
||||||
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
||||||
import org.eclipse.rse.ui.view.ISystemViewInputProvider;
|
import org.eclipse.rse.ui.view.ISystemViewInputProvider;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.dialogs.PropertyDialogAction;
|
||||||
import org.eclipse.ui.views.framelist.GoIntoAction;
|
import org.eclipse.ui.views.framelist.GoIntoAction;
|
||||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||||
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
|
@ -70,7 +71,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
|
||||||
*/
|
*/
|
||||||
public class SystemViewConnectionAdapter
|
public class SystemViewConnectionAdapter
|
||||||
extends AbstractSystemViewAdapter
|
extends AbstractSystemViewAdapter
|
||||||
implements ISystemViewElementAdapter, IRSEUserIdConstants
|
implements IRSEUserIdConstants
|
||||||
{
|
{
|
||||||
private SystemNewConnectionFromExistingConnectionAction anotherConnectionAction = null;
|
private SystemNewConnectionFromExistingConnectionAction anotherConnectionAction = null;
|
||||||
//private SystemUpdateConnectionAction updateAction = null;
|
//private SystemUpdateConnectionAction updateAction = null;
|
||||||
|
@ -262,6 +263,23 @@ public class SystemViewConnectionAdapter
|
||||||
return super.showOpenViewActions(element);
|
return super.showOpenViewActions(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showProperties(java.lang.Object)
|
||||||
|
*/
|
||||||
|
public boolean showProperties(Object element) {
|
||||||
|
// bugzilla#161195: _ALL_ actions needs to be passed to the system type for approval.
|
||||||
|
// _Never_ add any action without the system type provider having said ok to this.
|
||||||
|
if (element instanceof IHost) {
|
||||||
|
IRSESystemType sysType = getSystemTypeForHost((IHost)element);
|
||||||
|
Object adapter = sysType != null ? sysType.getAdapter(IRSESystemType.class) : null;
|
||||||
|
RSESystemTypeAdapter sysTypeAdapter = adapter instanceof RSESystemTypeAdapter ? (RSESystemTypeAdapter)adapter : null;
|
||||||
|
if (sysTypeAdapter != null) {
|
||||||
|
return sysTypeAdapter.acceptContextMenuActionContribution((IHost)element, PropertyDialogAction.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.showProperties(element);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRefresh(java.lang.Object)
|
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRefresh(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -63,7 +63,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
* behaviour. If this is done, you must register your subclass with the
|
* behaviour. If this is done, you must register your subclass with the
|
||||||
* platform's adapter manager in your plugin class's startup method.
|
* platform's adapter manager in your plugin class's startup method.
|
||||||
*/
|
*/
|
||||||
public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
|
public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
|
||||||
{
|
{
|
||||||
//private static String translatedFilterString = null;
|
//private static String translatedFilterString = null;
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
* These are the masters, and only shown in work-with for the master.
|
* These are the masters, and only shown in work-with for the master.
|
||||||
* These are children of SubSystemConfiguration objects
|
* These are children of SubSystemConfiguration objects
|
||||||
*/
|
*/
|
||||||
public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
|
public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter
|
||||||
{
|
{
|
||||||
protected String translatedType;
|
protected String translatedType;
|
||||||
//protected Object parent;
|
//protected Object parent;
|
||||||
|
|
|
@ -48,7 +48,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
* These are children of SubSystem objects
|
* These are children of SubSystem objects
|
||||||
*/
|
*/
|
||||||
public class SystemViewFilterPoolReferenceAdapter
|
public class SystemViewFilterPoolReferenceAdapter
|
||||||
extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
|
extends AbstractSystemViewAdapter
|
||||||
{
|
{
|
||||||
protected String translatedType;
|
protected String translatedType;
|
||||||
//protected Object parent;
|
//protected Object parent;
|
||||||
|
|
|
@ -72,7 +72,6 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
*/
|
*/
|
||||||
public class SystemViewFilterReferenceAdapter
|
public class SystemViewFilterReferenceAdapter
|
||||||
extends AbstractSystemViewAdapter
|
extends AbstractSystemViewAdapter
|
||||||
implements ISystemViewElementAdapter
|
|
||||||
{
|
{
|
||||||
//private static String translatedFilterString = null;
|
//private static String translatedFilterString = null;
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
/**
|
/**
|
||||||
* Default Adapter for displaying filter string objects in tree views.
|
* Default Adapter for displaying filter string objects in tree views.
|
||||||
*/
|
*/
|
||||||
public class SystemViewFilterStringAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
|
public class SystemViewFilterStringAdapter extends AbstractSystemViewAdapter
|
||||||
{
|
{
|
||||||
//private static String translatedFilterString = null;
|
//private static String translatedFilterString = null;
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||||
* <p>
|
* <p>
|
||||||
*/
|
*/
|
||||||
public class SystemViewMessageAdapter
|
public class SystemViewMessageAdapter
|
||||||
extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
|
extends AbstractSystemViewAdapter
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
* These are objects that, when expanded, launch a wizard to create something.
|
* These are objects that, when expanded, launch a wizard to create something.
|
||||||
*/
|
*/
|
||||||
public class SystemViewPromptableAdapter
|
public class SystemViewPromptableAdapter
|
||||||
extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
|
extends AbstractSystemViewAdapter
|
||||||
{
|
{
|
||||||
protected SystemRunAction runAction;
|
protected SystemRunAction runAction;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
/**
|
/**
|
||||||
* Adapter for the root-providing object of the SystemView tree viewer.
|
* Adapter for the root-providing object of the SystemView tree viewer.
|
||||||
*/
|
*/
|
||||||
public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
|
public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter
|
||||||
{
|
{
|
||||||
private SystemNewConnectionPromptObject newConnPrompt;
|
private SystemNewConnectionPromptObject newConnPrompt;
|
||||||
private Object[] newConnPromptArray;
|
private Object[] newConnPromptArray;
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
/**
|
/**
|
||||||
* Adapter for the root-providing object of the SystemView tree viewer.
|
* Adapter for the root-providing object of the SystemView tree viewer.
|
||||||
*/
|
*/
|
||||||
public class SystemViewScratchpadAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter,ISystemRemoteElementAdapter,ISystemDragDropAdapter
|
public class SystemViewScratchpadAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter,ISystemDragDropAdapter
|
||||||
{
|
{
|
||||||
|
|
||||||
private SystemPasteFromClipboardAction _pasteToScratchpadAction = null;
|
private SystemPasteFromClipboardAction _pasteToScratchpadAction = null;
|
||||||
|
|
|
@ -48,7 +48,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
|
||||||
* These are children of SystemConnection objects
|
* These are children of SystemConnection objects
|
||||||
*/
|
*/
|
||||||
public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
|
public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
|
||||||
implements ISystemViewElementAdapter, ISystemPropertyConstants, IRSEUserIdConstants
|
implements ISystemPropertyConstants, IRSEUserIdConstants
|
||||||
{
|
{
|
||||||
protected String translatedType;
|
protected String translatedType;
|
||||||
// for reset property support
|
// for reset property support
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
*/
|
*/
|
||||||
public class SystemTeamViewCategoryAdapter
|
public class SystemTeamViewCategoryAdapter
|
||||||
extends AbstractSystemViewAdapter
|
extends AbstractSystemViewAdapter
|
||||||
implements ISystemViewElementAdapter, IRSEUserIdConstants
|
implements IRSEUserIdConstants
|
||||||
{
|
{
|
||||||
|
|
||||||
private boolean actionsCreated = false;
|
private boolean actionsCreated = false;
|
||||||
|
|
|
@ -50,7 +50,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
*/
|
*/
|
||||||
public class SystemTeamViewProfileAdapter
|
public class SystemTeamViewProfileAdapter
|
||||||
extends AbstractSystemViewAdapter
|
extends AbstractSystemViewAdapter
|
||||||
implements ISystemViewElementAdapter, IRSEUserIdConstants
|
implements IRSEUserIdConstants
|
||||||
{
|
{
|
||||||
|
|
||||||
private boolean actionsCreated = false;
|
private boolean actionsCreated = false;
|
||||||
|
|
|
@ -39,7 +39,6 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
*/
|
*/
|
||||||
public class SystemTeamViewSubSystemConfigurationAdapter
|
public class SystemTeamViewSubSystemConfigurationAdapter
|
||||||
extends AbstractSystemViewAdapter
|
extends AbstractSystemViewAdapter
|
||||||
implements ISystemViewElementAdapter
|
|
||||||
{
|
{
|
||||||
private boolean actionsCreated = false;
|
private boolean actionsCreated = false;
|
||||||
//private Hashtable categoriesByProfile = new Hashtable();
|
//private Hashtable categoriesByProfile = new Hashtable();
|
||||||
|
|
|
@ -1035,6 +1035,22 @@ public abstract class AbstractSystemViewAdapter
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------
|
||||||
|
// METHODS TO SUPPORT COMMON PROPERTIES ACTION...
|
||||||
|
// ----------------------------------------------
|
||||||
|
/**
|
||||||
|
* <i><b>Overridable</b> by subclasses, and usually is.</i><br>
|
||||||
|
* Return true if we should show the properties action in the popup for the given element.
|
||||||
|
* Note the actual work to show the properties dialog is handled for you.
|
||||||
|
* <p>
|
||||||
|
* Default is true.
|
||||||
|
*/
|
||||||
|
public boolean showProperties(Object element)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS...
|
// METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS...
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
|
|
@ -321,6 +321,14 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD
|
||||||
*/
|
*/
|
||||||
public boolean showRefresh(Object element);
|
public boolean showRefresh(Object element);
|
||||||
|
|
||||||
|
// ----------------------------------------------
|
||||||
|
// METHODS TO SUPPORT COMMON PROPERTIES ACTION...
|
||||||
|
// ----------------------------------------------
|
||||||
|
/**
|
||||||
|
* Return true if we should show the properties action in the popup for the given element.
|
||||||
|
*/
|
||||||
|
public boolean showProperties(Object element);
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS...
|
// METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS...
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Reference in a new issue