i = aSet.iterator(); i.hasNext(); ){
String[] sSingleApplication = new String[2];
sSingleApplication[0] = i.next();
// assign the title in the second index
sSingleApplication[1] = aApplicationHashMap.get(sSingleApplication[0]);
sReturnList[n++] = sSingleApplication;
}
return sReturnList;
}
public void disposeHiddenDocuments(){
int nHiddenCount = aHiddenDocuments.size();
if (nHiddenCount > 0){
for (int i = nHiddenCount - 1; i >= 0; i--){
XComponent xComponent = aHiddenDocuments.get(i);
if (xComponent != null){
try {
XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, xComponent);
xCloseable.close(true);
aHiddenDocuments.remove(i);
} catch (CloseVetoException ex) {
ex.printStackTrace();
}
}
}
}
}
private static String[] getServiceNames() {
String[] sSupportedServiceNames = { __serviceName };
return sSupportedServiceNames;
}
// Implement the interface XServiceInfo
/** Get all supported service names.
* @return Supported service names.
*/
public String[] getSupportedServiceNames() {
return getServiceNames();
}
// Implement the interface XServiceInfo
/** Test, if the given service will be supported.
* @return Return true, if the service will be supported.
*/
public boolean supportsService( String sServiceName ) {
return sServiceName.equals( __serviceName );
}
// Implement the interface XServiceInfo
/** Get the implementation name of the component.
* @return Implementation name of the component.
*/
public String getImplementationName() {
return _Inspector.class.getName();
}
private int getSourceCodeLanguage(){
int nLanguage = XLanguageSourceCodeGenerator.nJAVA;
try{
XNameAccess xNameAccess = getConfigurationAccess("org.openoffice.inspector.ObjectInspector", false);
String sLanguage = (String) xNameAccess.getByName("Language");
if (sLanguage.toUpperCase().equals("JAVA")){
nLanguage = XLanguageSourceCodeGenerator.nJAVA;
}
else if (sLanguage.toUpperCase().equals("BASIC")){
nLanguage = XLanguageSourceCodeGenerator.nBASIC;
}
else if (sLanguage.toUpperCase().equals("CPLUSPLUS")){
nLanguage = XLanguageSourceCodeGenerator.nCPLUSPLUS;
}
else{
System.out.println("Warning: Sourcecode language " + sLanguage + " is not defined!");
}
m_oSwingDialogProvider.selectSourceCodeLanguage(nLanguage);
}catch( Exception exception ) {
exception.printStackTrace(System.err);
}
return nLanguage;
}
private XNameAccess getConfigurationAccess(boolean _bUpdate){
return getConfigurationAccess("org.openoffice.inspector.ObjectInspector", _bUpdate);
}
private XNameAccess getConfigurationAccess(String _sNodePath, boolean update) {
XNameAccess xNameAccess = null;
try {
String sAccess = "";
if (update) {
sAccess = "com.sun.star.configuration.ConfigurationUpdateAccess";
}
else{
sAccess = "com.sun.star.configuration.ConfigurationAccess";
}
XMultiComponentFactory xMCF = m_xComponentContext.getServiceManager();
XMultiServiceFactory xMSFCfg = theDefaultProvider.get(this.getXComponentContext());
Object oAccess = xMSFCfg.createInstanceWithArguments(sAccess, new Object[]{new NamedValue("nodepath", _sNodePath)});
xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oAccess);
} catch (com.sun.star.uno.Exception e) {
}
return xNameAccess;
}
}
// end of inner class
/**
* Gives a factory for creating the service.
* This method is called by the JavaLoader
*
* @return returns a XSingleComponentFactory
for creating
* the component
* @param sImplName the name of the implementation for which a
* service is desired
* @see com.sun.star.comp.loader.JavaLoader
*/
public static XSingleComponentFactory __getComponentFactory( String sImplName )
{
XSingleComponentFactory xFactory = null;
if ( sImplName.equals( _Inspector.class.getName() ) )
xFactory = Factory.createComponentFactory(_Inspector.class, _Inspector.getServiceNames());
if ( xFactory == null )
xFactory = InspectorAddon.__getComponentFactory(sImplName);
return xFactory;
}
/**
* Writes the service information into the given registry key.
* This method is called by the JavaLoader
*
* @return returns true if the operation succeeded
* @param regKey the registryKey
* @see com.sun.star.comp.loader.JavaLoader
*/
public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
return (Factory.writeRegistryServiceInfo(_Inspector.class.getName(), _Inspector.getServiceNames(), regKey)
&& InspectorAddon.__writeRegistryServiceInfo(regKey));
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */