mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
[173871] [api] Move archivehandlers extension point to org.eclipse.rse.services from org.eclipse.rse.ui. Also, move some classes related to archive handling to internal packages.
This commit is contained in:
parent
71e8bcdbaf
commit
45118db9d6
2 changed files with 47 additions and 45 deletions
|
@ -20,13 +20,18 @@ import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||||
import org.eclipse.core.runtime.ILog;
|
import org.eclipse.core.runtime.ILog;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Plugin;
|
import org.eclipse.core.runtime.Plugin;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.osgi.framework.Bundle;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main plugin class to be used in the desktop.
|
* The main plugin class to be used in the desktop.
|
||||||
*/
|
*/
|
||||||
|
@ -48,6 +53,7 @@ public class Activator extends Plugin {
|
||||||
*/
|
*/
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
|
registerArchiveHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -67,6 +73,46 @@ public class Activator extends Plugin {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the Archive Handler Manager, by registering archive \
|
||||||
|
* file types with their handlers.
|
||||||
|
* @author mjberger
|
||||||
|
*/
|
||||||
|
protected void registerArchiveHandlers()
|
||||||
|
{
|
||||||
|
// Get reference to the plug-in registry
|
||||||
|
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||||
|
|
||||||
|
// Get configured extenders
|
||||||
|
IConfigurationElement[] systemTypeExtensions = registry.getConfigurationElementsFor("org.eclipse.rse.services", "archivehandlers"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
|
for (int i = 0; i < systemTypeExtensions.length; i++) {
|
||||||
|
String ext = systemTypeExtensions[i].getAttribute("fileNameExtension"); //$NON-NLS-1$
|
||||||
|
if (ext.startsWith(".")) ext = ext.substring(1); //$NON-NLS-1$
|
||||||
|
String handlerType = systemTypeExtensions[i].getAttribute("class"); //$NON-NLS-1$
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// get the name space of the declaring extension
|
||||||
|
String nameSpace = systemTypeExtensions[i].getDeclaringExtension().getNamespaceIdentifier();
|
||||||
|
|
||||||
|
// 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 handler = bundle.loadClass(handlerType);
|
||||||
|
ArchiveHandlerManager.getInstance().setRegisteredHandler(ext, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ClassNotFoundException e)
|
||||||
|
{
|
||||||
|
logException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an throwable to the log for this plugin.
|
* Logs an throwable to the log for this plugin.
|
||||||
* @param t the Throwable to be logged.
|
* @param t the Throwable to be logged.
|
||||||
|
@ -113,5 +159,4 @@ public class Activator extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
//</tracing code>---------------------------------------------------
|
//</tracing code>---------------------------------------------------
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
* Copyright (c) 2006, 2007 IBM Corporation. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -51,7 +51,6 @@ import org.eclipse.rse.model.SystemRegistry;
|
||||||
import org.eclipse.rse.model.SystemResourceChangeEvent;
|
import org.eclipse.rse.model.SystemResourceChangeEvent;
|
||||||
import org.eclipse.rse.model.SystemStartHere;
|
import org.eclipse.rse.model.SystemStartHere;
|
||||||
import org.eclipse.rse.persistence.IRSEPersistenceManager;
|
import org.eclipse.rse.persistence.IRSEPersistenceManager;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
|
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
|
||||||
|
@ -472,7 +471,6 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
||||||
daemon.startDaemon(false);
|
daemon.startDaemon(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
registerArchiveHandlers();
|
|
||||||
registerDynamicPopupMenuExtensions();
|
registerDynamicPopupMenuExtensions();
|
||||||
registerKeystoreProviders();
|
registerKeystoreProviders();
|
||||||
|
|
||||||
|
@ -984,47 +982,6 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
||||||
viewSuppliers.remove(vs);
|
viewSuppliers.remove(vs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the Archive Handler Manager, by registering archive \
|
|
||||||
* file types with their handlers.
|
|
||||||
* @author mjberger
|
|
||||||
*/
|
|
||||||
protected void registerArchiveHandlers()
|
|
||||||
{
|
|
||||||
// Get reference to the plug-in registry
|
|
||||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
|
||||||
|
|
||||||
// Get configured extenders
|
|
||||||
IConfigurationElement[] systemTypeExtensions = registry.getConfigurationElementsFor("org.eclipse.rse.ui", "archivehandlers"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
|
|
||||||
for (int i = 0; i < systemTypeExtensions.length; i++) {
|
|
||||||
String ext = systemTypeExtensions[i].getAttribute("fileNameExtension"); //$NON-NLS-1$
|
|
||||||
if (ext.startsWith(".")) ext = ext.substring(1); //$NON-NLS-1$
|
|
||||||
String handlerType = systemTypeExtensions[i].getAttribute("class"); //$NON-NLS-1$
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// get the name space of the declaring extension
|
|
||||||
String nameSpace = systemTypeExtensions[i].getDeclaringExtension().getNamespaceIdentifier();
|
|
||||||
|
|
||||||
// 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 handler = bundle.loadClass(handlerType);
|
|
||||||
ArchiveHandlerManager.getInstance().setRegisteredHandler(ext, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ClassNotFoundException e)
|
|
||||||
{
|
|
||||||
logError("Cound not find archive handler class", e); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the System View Adapter Menu Extension Manager, by registering menu extensions
|
* Initializes the System View Adapter Menu Extension Manager, by registering menu extensions
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue