Examples of XChangesBatch


Examples of com.sun.star.util.XChangesBatch

        {
            m_bShowInBrowser = new Boolean( bValue );

            XPropertySet xProps = Helper.GetConfigProps( xContext, "org.openoffice.Office.Custom.WikiExtension/Settings" );
            xProps.setPropertyValue( "PreselectShowBrowser", new Boolean( bValue ) );
            XChangesBatch xBatch = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xProps );
            if ( xBatch != null )
                xBatch.commitChanges();
        }
        catch( Exception e )
        {
            e.printStackTrace();
        }
View Full Code Here

Examples of com.sun.star.util.XChangesBatch

            oInetProps.setPropertyValue("ooInetHTTPProxyName", HTTPProxyName);
            oInetProps.setPropertyValue("ooInetHTTPProxyPort", HTTPProxyPort);
            oInetProps.setPropertyValue("ooInetProxyType", new Long(2));

            XChangesBatch oSecureChange = (XChangesBatch) UnoRuntime.queryInterface(
                                                  XChangesBatch.class, oInet);
            oSecureChange.commitChanges();
        }
        catch(com.sun.star.uno.Exception e) {
            e.printStackTrace();
        }
        return true;
View Full Code Here

Examples of com.sun.star.util.XChangesBatch

                    UnoRuntime.queryInterface(XPropertySet.class, oScripting);
           
            oScriptingSettings.setPropertyValue("Warning", Boolean.FALSE);
            oScriptingSettings.setPropertyValue("OfficeBasic", new Integer(2));
           
            XChangesBatch oSecureChange = (XChangesBatch)
                    UnoRuntime.queryInterface(XChangesBatch.class, oSecure);
            oSecureChange.commitChanges();
           
            // As we want to have some information about a debugFile
            // BEFORE connection is established
            // we pass the information about it in frame name.
            String sFrameName = (String)tParam.get(
View Full Code Here

Examples of com.sun.star.util.XChangesBatch

        else if(sReadLine.startsWith("EndUpdate"))
        {
          try
          {     
                        myprintln("COMMAND: " + sReadLine);
                        XChangesBatch xChangesBatch = (com.sun.star.util.XChangesBatch)UnoRuntime.queryInterface(com.sun.star.util.XChangesBatch.class, xCfgUpdateAccess);
              if(xChangesBatch.hasPendingChanges())
              {
                xChangesBatch.commitChanges();
                //myprintln("The changes have been commmitted");
              }
              else
              {
                myprintln("There are no changes to commmit");
              }
          }
          catch(Exception e)
          {   
            myprintln("Exception while commit the changes");                                               
          }
        }
//        DO        //
        else if(sReadLine.startsWith("Do"))
            {
               
                try
                {
                    myprintln("COMMAND: " + sReadLine);                               
                  StringTokenizer st = new StringTokenizer(sReadLine.substring((sReadLine.indexOf("(")+1), sReadLine.lastIndexOf(")")), ";");
                  int noOfTokens = st.countTokens();
                  int noOfLoops = Integer.parseInt(st.nextToken());                 
                  String sCommand = st.nextToken();
                  for ( int i = 1; i <= noOfLoops ;i++)
                  {
                      if ( sCommand.startsWith("ReadNode") )
                      {                     
                          StringTokenizer st2 = new StringTokenizer(sCommand.substring((sCommand.indexOf("(")+1), sCommand.lastIndexOf(")")), ",");                     
                          myprintln("COMMAND: " + sCommand);
                          int noOfTokens2 = st2.countTokens();
                          String startNodeName=st2.nextToken();
                          int outputDepth = -1;
                          if(noOfTokens2 == 2)
                          {                
                              String newString = st2.nextToken().trim();       
                            outputDepth = Integer.parseInt(newString);              
                          }                     
                          readNodes(startNodeName,outputDepth);       
                      }
                      if ( sCommand.startsWith("ReadValue") )
                      {                     
                          StringTokenizer st2 = new StringTokenizer(sCommand.substring((sCommand.indexOf("(")+1), sCommand.lastIndexOf(")")), ",");                     
                          String startNodeName=st2.nextToken();
                          int outputDepth = -1;                                                                     
                          myprintln("COMMAND: " + sCommand);
                          readValue(startNodeName);       
                      }
                      else if ( sCommand.startsWith("UpdateNodeDirect"))
                      {
                          myprintln("COMMAND: " + sCommand);                     
                      StringTokenizer st2 = new StringTokenizer(sCommand.substring((sCommand.indexOf("(")+1), sCommand.lastIndexOf(")")), ",");
                      String sValueName=st2.nextToken();
                      String sNewValue=st2.nextToken();
                      updateNode(sValueName,sNewValue,1);
                      }                 
                      else if ( sCommand.startsWith("UpdateNode"))
                      {
                          myprintln("COMMAND: " + sReadLine);                               
                      StringTokenizer st2 = new StringTokenizer(sCommand.substring((sCommand.indexOf("(")+1), sCommand.lastIndexOf(")")), ",");
                      String sValueName=st2.nextToken();
                      String sNewValue=st2.nextToken();
                      updateNode(sValueName,sNewValue,2,xCfgUpdateAccess );
                      }
                  }
              }
              catch (Exception e)
              {
                  System.out.println(e);             
              }
            }       
//        WAIT        //                       
            else if(sReadLine.startsWith("Wait"))
            {
                myprintln("COMMAND: " + sReadLine);                               
              StringTokenizer st = new StringTokenizer(sReadLine.substring((sReadLine.indexOf("(")+1), sReadLine.lastIndexOf(")")), ",");             
              int secToWait = Integer.parseInt(st.nextToken());
              java.lang.Thread.sleep(secToWait * 1000);
            }
//        ADD NODE        //           
            else if(sReadLine.startsWith("AddNode"))
            {
                try
                {
                    myprintln("COMMAND: " + sReadLine);                               
                  StringTokenizer st = new StringTokenizer(sReadLine.substring((sReadLine.indexOf("(")+1), sReadLine.lastIndexOf(")")), ",");                                         
                  String startNodeName = st.nextToken();
                  String sNewNodeName = st.nextToken();
                 
                  XInterface myCfgUpdateAccess = (XInterface) myConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", new Object[]{startNodeName, new Integer(-1)});                       
                 
                  com.sun.star.lang.XServiceInfo myServicex = (com.sun.star.lang.XServiceInfo)UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class, myCfgUpdateAccess);             
                  String [] xx = myServicex.getSupportedServiceNames();
                 
                  com.sun.star.lang.XServiceInfo myService = (com.sun.star.lang.XServiceInfo)UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class, myCfgUpdateAccess);             
                  boolean bSupport = myService.supportsService("com.sun.star.configuration.ConfigurationContainer");
                  //boolean bSupport = true;
                 
                  if(bSupport)
                  {
                      // create a new empty node
                      com.sun.star.lang.XSingleServiceFactory myFac = (com.sun.star.lang.XSingleServiceFactory)UnoRuntime.queryInterface(com.sun.star.lang.XSingleServiceFactory.class, myCfgUpdateAccess);             
                      XInterface myNewChild = (XInterface)myFac.createInstance();                      
                     
                      // query the namecontainer on the node and insert it                 
                      com.sun.star.container.XNameContainer myNameContainer = (com.sun.star.container.XNameContainer)UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, myCfgUpdateAccess);             
                      myNameContainer.insertByName(sNewNodeName,myNewChild);
                     
                      // commit the changes
                      com.sun.star.util.XChangesBatch xChangesBatch = (com.sun.star.util.XChangesBatch)UnoRuntime.queryInterface(com.sun.star.util.XChangesBatch.class, myCfgUpdateAccess);             
                        xChangesBatch.commitChanges();
                  }
                  else
                  {
                      myprintln("ERROR: " + startNodeName + " didn't support addNode");                               
                  }                 
                 
              }
              catch (Exception e)
              {
                  myprintln(e.toString());
                  myprintln(getTargetMessages(e));
              }
          }
//        REMOVE NODE        //           
            else if(sReadLine.startsWith("RemoveNode"))
            {
                try
                {
                    myprintln("COMMAND: " + sReadLine);                               
                  StringTokenizer st = new StringTokenizer(sReadLine.substring((sReadLine.indexOf("(")+1), sReadLine.lastIndexOf(")")), ",");                                         
                  String startNodeName = st.nextToken();
                  String sNodeName = st.nextToken();
                 
                  XInterface myCfgUpdateAccess = (XInterface) myConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", new Object[]{startNodeName, new Integer(-1)});                       
                 
                  com.sun.star.lang.XServiceInfo myServicex = (com.sun.star.lang.XServiceInfo)UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class, myCfgUpdateAccess);             
                  String [] xx = myServicex.getSupportedServiceNames();
                 
                  com.sun.star.lang.XServiceInfo myService = (com.sun.star.lang.XServiceInfo)UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class, myCfgUpdateAccess);             
                  //boolean bSupport = myService.supportsService("com.sun.star.configuration.ConfigurationContainer");
                  boolean bSupport = true;
                 
                  if(bSupport)
                  {
                      // query the namecontainer on the node and remove the given nodename
                      com.sun.star.container.XNameContainer myNameContainer = (com.sun.star.container.XNameContainer)UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, myCfgUpdateAccess);             
                      myNameContainer.removeByName(sNodeName);
                     
                      // commit the changes
                      com.sun.star.util.XChangesBatch xChangesBatch = (com.sun.star.util.XChangesBatch)UnoRuntime.queryInterface(com.sun.star.util.XChangesBatch.class, myCfgUpdateAccess);             
                        xChangesBatch.commitChanges();
                  }
                  else
                  {
                      myprintln("ERROR: " + startNodeName + " didn't support removeNode");                               
                  }                 
View Full Code Here

Examples of com.sun.star.util.XChangesBatch

        changeSomeData( cGridOptionsPath + "/Subdivision" );

        if (dialog.execute() == GridOptionsEditor.SAVE_SETTINGS)
        {
            // changes have been applied to the view here
            XChangesBatch xUpdateControl =
                (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
       
            try
            {
               xUpdateControl.commitChanges();
            }
            catch (Exception e)
            {
                dialog.informUserOfError( e );
            }
View Full Code Here

Examples of com.sun.star.util.XChangesBatch

                    aReplace.replaceByName( aItemNames [i], new Boolean( bNew ) );
                }
            }

            // commit the changes
            XChangesBatch xUpdateControl =
                (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xOtherViewRoot);
       
            xUpdateControl.commitChanges();

            // we are done with the view - dispose it
            ((XComponent)UnoRuntime.queryInterface(XComponent.class, xOtherViewRoot)).dispose();
        }
        catch (Exception e)
View Full Code Here

Examples of com.sun.star.util.XChangesBatch

            (XMultiPropertyStates)UnoRuntime.queryInterface(XMultiPropertyStates.class, xSubdivision);
   
        xSubdivisionStates.setAllPropertiesToDefault();

        // commit the changes
        XChangesBatch xUpdateControl =
            (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
   
        xUpdateControl.commitChanges();

       // we are done with the view - dispose it
        ((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose();
    }
View Full Code Here

Examples of com.sun.star.util.XChangesBatch

      // save the data and dispose the view
        // recover the view root
        Object xViewRoot = getViewRoot(xDataSource);

        // commit the changes
        XChangesBatch xUpdateControl =
            (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
       
        xUpdateControl.commitChanges();

        // now clean up
        ((XComponent) UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose();
    }
View Full Code Here

Examples of com.sun.star.util.XChangesBatch

                //Finally we can set the value
                xLeaf.setPropertyValue(m_arStringControls[i], sValue);
            }

            //Committing the changes will cause or changes to be written to the registry.
            XChangesBatch xUpdateCommit =
                (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, m_xAccessLeaves);
            xUpdateCommit.commitChanges();
        }
View Full Code Here

Examples of com.sun.star.util.XChangesBatch

                    xNewConn.replaceByName( "UserName", ht.get( "Username" ) );
                xContainer.insertByName( (String)ht.get( "Url" ), xNewConn );
            }
            // commit changes
            XChangesBatch xBatch = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer );
            xBatch.commitChanges();
           
            // remove stored connection information
            XNameContainer xContainer2 = Helper.GetConfigNameContainer( m_xContext, "org.openoffice.Office.Custom.WikiExtension/RecentDocs" );
            String[] pNames2 = xContainer2.getElementNames();
            for( int i=0; i<pNames2.length; i++ )
            {
                xContainer2.removeByName( pNames2[i] );
            }
            // store all Docs
            XSingleServiceFactory xDocListFactory = ( XSingleServiceFactory ) UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer2 );
            for ( int i=0; i< m_aWikiDocs.size(); i++ )
            {
                Hashtable ht = ( Hashtable ) m_aWikiDocs.get( i );
               
                Object oNewDoc = xDocListFactory.createInstance();
                XNameReplace xNewDoc = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewDoc );
               
                Enumeration e = ht.keys();
                while ( e.hasMoreElements() )
                {
                    String key = ( String ) e.nextElement();
                    xNewDoc.replaceByName( key, ht.get( key ) );
                }
               
                xContainer2.insertByName( "d" + i, xNewDoc );
            }
            // commit changes
            XChangesBatch xBatch2 = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer2 );
            xBatch2.commitChanges();
           
        }
        catch ( Exception ex )
        {
            ex.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.