1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 23:25:26 +02:00

[185554][api] Remove dynamicPopupMenuExtensions extension point

This commit is contained in:
Martin Oberhuber 2007-05-10 16:28:43 +00:00
parent 330e563896
commit 1fe5c4b9dd
9 changed files with 13 additions and 340 deletions

View file

@ -1,7 +1,7 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2005, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2005, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>RSE Extension Points</title>
<link rel="stylesheet" type="text/css" HREF="../../book.css">
@ -17,7 +17,6 @@
<!-- TODODeferred after RSE 1.0
<li><a href="org_eclipse_rse_ui_compile.html">org.eclipse.rse.ui.compile</a></li>
-->
<li><a href="org_eclipse_rse_ui_dynamicPopupMenuExtensions.html">org.eclipse.rse.ui.dynamicPopupMenuExtensions</a></li>
<li><a href="org_eclipse_rse_ui_keystoreProviders.html">org.eclipse.rse.ui.keystoreProviders</a></li>
<li><a href="org_eclipse_rse_ui_mountPathMappers.html">org.eclipse.rse.ui.mountPathMappers</a></li>
<li><a href="org_eclipse_rse_ui_newConnectionWizards.html">org.eclipse.rse.ui.newConnectionWizards</a></li>

View file

@ -12,7 +12,6 @@
<!-- TODODeferred after RSE 1.0
<topic label="org.eclipse.rse.ui.compile" href="reference/extension-points/org_eclipse_rse_ui_compile.html" />
-->
<topic label="org.eclipse.rse.ui.dynamicPopupMenuExtensions" href="reference/extension-points/org_eclipse_rse_ui_dynamicPopupMenuExtensions.html" />
<topic label="org.eclipse.rse.ui.keystoreProviders" href="reference/extension-points/org_eclipse_rse_ui_keystoreProviders.html" />
<topic label="org.eclipse.rse.ui.mountPathMappers" href="reference/extension-points/org_eclipse_rse_ui_mountPathMappers.html" />
<topic label="org.eclipse.rse.ui.newConnectionWizards" href="reference/extension-points/org_eclipse_rse_ui_newConnectionWizards.html" />

View file

@ -1,74 +0,0 @@
/********************************************************************************
* Copyright (c) 2005, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.ui.actions;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.ui.SystemMenuManager;
import org.eclipse.rse.ui.actions.ISystemDynamicPopupMenuExtension;
import org.eclipse.rse.ui.actions.ISystemDynamicPopupMenuExtensionManager;
import org.eclipse.swt.widgets.Shell;
/**
*
* Singleton class for managing adapter menu extensions.
* View adapters that support this feature, should call populateMenu to allow for
* extended menu contributions.
*/
public class SystemDynamicPopupMenuExtensionManager implements
ISystemDynamicPopupMenuExtensionManager
{
private static SystemDynamicPopupMenuExtensionManager _instance = new SystemDynamicPopupMenuExtensionManager();
private List _extensions;
private SystemDynamicPopupMenuExtensionManager()
{
_extensions= new ArrayList();
}
public static SystemDynamicPopupMenuExtensionManager getInstance()
{
return _instance;
}
public void registerMenuExtension(ISystemDynamicPopupMenuExtension ext)
{
_extensions.add(ext);
}
/**
* Actions are added to a contribution menu.
* @param shell the shell
* @param menu the menu to contribute to
* @param selection are processed to determine the resource source file
* @param menuGroup the default menu group to add actions to
*/
public void populateMenu(Shell shell, SystemMenuManager menu,IStructuredSelection selection, String menuGroup)
{
for (int i = 0; i <_extensions.size(); i++)
{
ISystemDynamicPopupMenuExtension extension = (ISystemDynamicPopupMenuExtension)_extensions.get(i);
if (extension.supportsSelection(selection))
{
extension.populateMenu(shell, menu, selection, menuGroup);
}
}
}
}

View file

@ -16,6 +16,7 @@
* David Dykstal (IBM) - 168870: move core function from UI to core
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
* Martin Oberhuber (Wind River) - [185554] Remove dynamicPopupMenuExtensions extension point
********************************************************************************/
package org.eclipse.rse.ui;
@ -54,7 +55,6 @@ import org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxy;
import org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxyComparator;
import org.eclipse.rse.internal.ui.RSESystemTypeAdapterFactory;
import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.actions.SystemDynamicPopupMenuExtensionManager;
import org.eclipse.rse.internal.ui.actions.SystemShowPreferencesPageAction;
import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapterFactory;
import org.eclipse.rse.internal.ui.view.SubSystemConfigurationAdapterFactory;
@ -64,7 +64,6 @@ import org.eclipse.rse.persistence.IRSEPersistenceManager;
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
import org.eclipse.rse.ui.actions.ISystemDynamicPopupMenuExtension;
import org.eclipse.rse.ui.internal.model.SystemRegistry;
import org.eclipse.rse.ui.model.ISystemRegistryUI;
import org.osgi.framework.Bundle;
@ -107,7 +106,6 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
SystemResourceListener listener = SystemResourceListener.getListener(remoteSystemsProject);
SystemResourceManager.startResourceEventListening(listener);
registerDynamicPopupMenuExtensions();
registerKeystoreProviders();
// new support to allow products to not pre-create a local connection
@ -970,47 +968,6 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
viewSuppliers.remove(vs);
}
/**
* Initializes the System View Adapter Menu Extension Manager, by registering menu extensions
*/
protected void registerDynamicPopupMenuExtensions()
{
// Get reference to the plug-in registry
IExtensionRegistry registry = Platform.getExtensionRegistry();
// Get configured extenders
IConfigurationElement[] systemTypeExtensions = registry.getConfigurationElementsFor("org.eclipse.rse.ui", "dynamicPopupMenuExtensions"); //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i < systemTypeExtensions.length; i++)
{
try
{
// get the name space of the declaring extension
String nameSpace = systemTypeExtensions[i].getDeclaringExtension().getNamespaceIdentifier();
String menuExtensionType = systemTypeExtensions[i].getAttribute("class"); //$NON-NLS-1$
// use the name space to get the bundle
Bundle bundle = Platform.getBundle(nameSpace);
// if the bundle has not been uninstalled, then load the handler referred to in the
// extension, and load it using the bundle
// then register the handler
if (bundle.getState() != Bundle.UNINSTALLED)
{
Class menuExtension = bundle.loadClass(menuExtensionType);
ISystemDynamicPopupMenuExtension extension = (ISystemDynamicPopupMenuExtension)menuExtension.getConstructors()[0].newInstance(null);
SystemDynamicPopupMenuExtensionManager.getInstance().registerMenuExtension(extension);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
protected void registerKeystoreProviders()
{
// Get reference to the plug-in registry

View file

@ -1,44 +0,0 @@
/********************************************************************************
* Copyright (c) 2005, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.ui.actions;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.ui.SystemMenuManager;
import org.eclipse.swt.widgets.Shell;
/**
* Required interface for use in making contributions view the
* adapter menu extension extension point (org.eclipse.rse.ui.dynamicPopupMenuExtensions).
*/
public interface ISystemDynamicPopupMenuExtension
{
/**
* Returns true if this menu extension supports the specified selection.
* @param selection the resources to contriubte menu items to
* @return true if the extension will be used for menu population
*/
public boolean supportsSelection(IStructuredSelection selection);
/**
* Populates the menu with specialized actions.
* @param shell the shell
* @param menu the menu to contribute actions to
* @param menuGroup the defect menu group to add actions to
* @param selection the resources to contriubte menu items to
*
*/
public void populateMenu(Shell shell, SystemMenuManager menu, IStructuredSelection selection, String menuGroup);
}

View file

@ -1,23 +0,0 @@
/********************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.ui.actions;
/**
* @author dmcknigh
*/
public interface ISystemDynamicPopupMenuExtensionManager {
}

View file

@ -54,7 +54,6 @@ import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter;
import org.eclipse.rse.internal.ui.SystemPropertyResources;
import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.actions.SystemDynamicPopupMenuExtensionManager;
import org.eclipse.rse.internal.ui.view.ISystemMementoConstants;
import org.eclipse.rse.internal.ui.view.SystemViewPart;
import org.eclipse.rse.internal.ui.view.SystemViewResources;
@ -349,10 +348,14 @@ public abstract class AbstractSystemViewAdapter implements ISystemViewElementAda
/**
* <i>Called by system viewers. No need to override or call.</i><br>
* Contributes actions provided via the <code>dynamicPopupMenuExtensions</code> extension point. Unlike
* addCommonRemoteActions(), these contributions are for any artifact in the RSE views and are contributed
* independently of subsystem factories.
* Add or remove custom actions dynamically to a context menu.
*
* This method is called by the system viewers. Extenders may
* override this method in order to modify the context menu
* shown for elements of the type they adapt to.
* Unlike addCommonRemoteActions(), these contributions are for
* any artifact in the RSE views and are contributed independently
* of subsystem factories.
*
* @param menu The menu to contribute actions to
* @param selection The window's current selection.
@ -361,9 +364,8 @@ public abstract class AbstractSystemViewAdapter implements ISystemViewElementAda
*/
public void addDynamicPopupMenuActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
{
// system view adapter menu extensions
// empty by default, extenders may override.
// these extensions are independent of subsystem factories and are contributed via extension point
SystemDynamicPopupMenuExtensionManager.getInstance().populateMenu(shell, menu, selection, menuGroup);
}
/**

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2006 IBM Corporation. All rights reserved.
Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
This program and the accompanying materials are made available under the terms
of the Eclipse Public License v1.0 which accompanies this distribution, and is
available at http://www.eclipse.org/legal/epl-v10.html
@ -12,7 +12,7 @@ Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
Contributors:
{Name} (company) - description of contribution.
Martin Oberhuber (Wind River) - [185554] Remove dynamicPopupMenuExtensions extension point
-->
<?eclipse version="3.1"?>
<plugin>
@ -445,11 +445,6 @@ Contributors:
<!-- ================================================================= -->
<extension-point id="mountPathMappers" name="%extPoint.mountPathMappers" schema="schema/mountPathMappers.exsd"/>
<!-- ================================================================= -->
<!-- Define Dynamic Popup Menu Extension extension point -->
<!-- ================================================================= -->
<extension-point id="dynamicPopupMenuExtensions" name="%extPoint.dynamicPopupMenuExtensions" schema="schema/dynamicPopupMenuExtensions.exsd"/>
<!-- ================================================================= -->
<!-- Define Keystore Provider extension point -->
<!-- ================================================================= -->

View file

@ -1,138 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.rse.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.rse.ui" id="dynamicPopupMenuExtensions" name="View Menu Extensions"/>
</appInfo>
<documentation>
This extension point is used to allow programmatic menu contributions via view adapters that allow for extension.
</documentation>
</annotation>
<element name="extension">
<annotation>
<documentation>
(no description available)
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="dynamicPopupMenuExtension" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="dynamicPopupMenuExtension">
<annotation>
<appInfo>
<meta.element labelAttribute="name"/>
</appInfo>
<documentation>
(no description available)
</documentation>
</annotation>
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
a unique name that will be used to identify this extension.
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
a translatable name that will be used to identify this Popup Menu Extension in the UI.
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
a fully qualified name of the Java class that implements the &lt;samp&gt;org.eclipse.rse.ui.actions.ISystemDynamicPopupMenuExtension&lt;/samp&gt; interface.
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.rse.ui.actions.ISystemDynamicPopupMenuExtension"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
The following is an example of this extension point&apos;s usage:
&lt;p&gt;
&lt;pre&gt;
&lt;extension point=&quot;org.eclipse.rse.ui.dynamicPopupMenuExtensions&quot;&gt;
&lt;dynamicPopupMenuExtension
id=&quot;com.abc.ui.MyPopupMenuExtension&quot;
name=&quot;My Popup Menu Extension&quot;
class=&quot;com.abc.MyPopupMenuExtension&quot;&gt;
&lt;/dynamicPopupMenuExtension&gt;
&lt;/extension&gt;
&lt;/pre&gt;
&lt;/p&gt;
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
Plug-ins that want to extend this extension point must implement &lt;samp&gt;org.eclipse.rse.ui.actions.ISystemDynamicPopupMenuExtension&lt;/samp&gt; interface.
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
By default there are not contributions to this.
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
Copyright (c) 2002, 2006 IBM Corporation. All Rights Reserved.
This program and the accompanying materials are made available under the terms
of the Eclipse Public License v1.0 which accompanies this distribution, and is
available at http://www.eclipse.org/legal/epl-v10.html
Contributors:
IBM Corporation - initial API and implementation
</documentation>
</annotation>
</schema>