1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 07:35:24 +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:
Uwe Stieber 2007-03-06 17:15:17 +00:00
parent d546610333
commit b122732f45
17 changed files with 72 additions and 25 deletions

View file

@ -189,6 +189,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
protected SystemCommonRenameAction renameAction; // for common rename menu item
protected SystemCommonSelectAllAction selectAllAction; // for common Ctrl+A select-all
// special flags needed when building popup menu, set after examining selections
protected boolean selectionShowPropertiesAction;
protected boolean selectionShowRefreshAction;
protected boolean selectionShowOpenViewActions;
protected boolean selectionShowGenericShowInTableAction;
@ -872,20 +873,15 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
((ISystemAction) getDeleteAction()).setInputs(getShell(), this, selection);
menu.add(new Separator());
}
// PROPERTIES ACTION...
// 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.
//propertyDialogAction.selectionChanged(selection);
PropertyDialogAction pdAction = getPropertyDialogAction();
if (pdAction.isApplicableForSelection()) menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
if (showProperties()) {
PropertyDialogAction pdAction = getPropertyDialogAction();
if (pdAction.isApplicableForSelection()) menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
}
// GO INTO 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...
selectionShowPropertiesAction = true;
selectionShowRefreshAction = true;
selectionShowOpenViewActions = true;
selectionShowGenericShowInTableAction = true;
@ -4210,6 +4207,8 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
ISystemViewElementAdapter adapter = getViewAdapter(element);
if (adapter == null) continue;
if (selectionShowPropertiesAction) selectionShowPropertiesAction = adapter.showProperties(element);
if (selectionShowRefreshAction) selectionShowRefreshAction = adapter.showRefresh(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.
* Assumes scanSelections() has already been called

View file

@ -59,6 +59,7 @@ import org.eclipse.rse.ui.view.ISystemPropertyConstants;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
import org.eclipse.rse.ui.view.ISystemViewInputProvider;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.PropertyDialogAction;
import org.eclipse.ui.views.framelist.GoIntoAction;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor;
@ -70,7 +71,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
*/
public class SystemViewConnectionAdapter
extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, IRSEUserIdConstants
implements IRSEUserIdConstants
{
private SystemNewConnectionFromExistingConnectionAction anotherConnectionAction = null;
//private SystemUpdateConnectionAction updateAction = null;
@ -262,6 +263,23 @@ public class SystemViewConnectionAdapter
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)
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#showRefresh(java.lang.Object)
*/

View file

@ -63,7 +63,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
* behaviour. If this is done, you must register your subclass with the
* 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;
// -------------------

View file

@ -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 children of SubSystemConfiguration objects
*/
public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter
{
protected String translatedType;
//protected Object parent;

View file

@ -48,7 +48,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
* These are children of SubSystem objects
*/
public class SystemViewFilterPoolReferenceAdapter
extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
extends AbstractSystemViewAdapter
{
protected String translatedType;
//protected Object parent;

View file

@ -71,8 +71,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
* These are children of SystemFilterPoolReference and SystemFilterReference objects
*/
public class SystemViewFilterReferenceAdapter
extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter
extends AbstractSystemViewAdapter
{
//private static String translatedFilterString = null;
// -------------------

View file

@ -41,7 +41,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
/**
* 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;
// -------------------

View file

@ -35,7 +35,7 @@ import org.eclipse.ui.views.properties.IPropertyDescriptor;
* <p>
*/
public class SystemViewMessageAdapter
extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
extends AbstractSystemViewAdapter
{
/**

View file

@ -33,7 +33,7 @@ import org.eclipse.swt.widgets.Shell;
* These are objects that, when expanded, launch a wizard to create something.
*/
public class SystemViewPromptableAdapter
extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
extends AbstractSystemViewAdapter
{
protected SystemRunAction runAction;

View file

@ -36,7 +36,7 @@ import org.eclipse.swt.widgets.Shell;
/**
* 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 Object[] newConnPromptArray;

View file

@ -38,7 +38,7 @@ import org.eclipse.swt.widgets.Shell;
/**
* 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;

View file

@ -48,7 +48,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
* These are children of SystemConnection objects
*/
public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, ISystemPropertyConstants, IRSEUserIdConstants
implements ISystemPropertyConstants, IRSEUserIdConstants
{
protected String translatedType;
// for reset property support

View file

@ -41,7 +41,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
*/
public class SystemTeamViewCategoryAdapter
extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, IRSEUserIdConstants
implements IRSEUserIdConstants
{
private boolean actionsCreated = false;

View file

@ -50,7 +50,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
*/
public class SystemTeamViewProfileAdapter
extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, IRSEUserIdConstants
implements IRSEUserIdConstants
{
private boolean actionsCreated = false;

View file

@ -38,8 +38,7 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
* the Team view.
*/
public class SystemTeamViewSubSystemConfigurationAdapter
extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter
extends AbstractSystemViewAdapter
{
private boolean actionsCreated = false;
//private Hashtable categoriesByProfile = new Hashtable();

View file

@ -1035,6 +1035,22 @@ public abstract class AbstractSystemViewAdapter
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...
// ------------------------------------------------------------

View file

@ -321,6 +321,14 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD
*/
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...
// ------------------------------------------------------------