From 883fbf89e446d9257229088e589b2d6d4baac2bf Mon Sep 17 00:00:00 2001
From: Chan Le Duc <chan.leduc@univ-paris13.fr>
Date: Thu, 29 Jan 2009 10:52:12 +0000
Subject: [PATCH] --Added parameters for matching with WSAlignment

---
 .../align/plugin/neontk/OfflineAlign.java     |   6 +-
 .../exmo/align/plugin/neontk/OnlineAlign.java | 217 +++++++++++++----
 .../align/plugin/neontk/SWTInterface.java     | 226 ++++++++++++------
 3 files changed, 324 insertions(+), 125 deletions(-)

diff --git a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OfflineAlign.java b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OfflineAlign.java
index 697b1a2a..ffce9164 100755
--- a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OfflineAlign.java
+++ b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OfflineAlign.java
@@ -115,9 +115,9 @@ public class OfflineAlign {
 	  	
 	  	AlignmentVisitor V = new OWLAxiomsRendererVisitor(  new PrintWriter ( owlF )  );
 	  	
-	  	ObjectAlignment al = ObjectAlignment.toObjectAlignment( (URIAlignment)A1 );
-		al.render( V );
-	  	//A1.render(V);
+	  	//ObjectAlignment al = ObjectAlignment.toObjectAlignment( (URIAlignment)A1 );
+		//al.render( V );
+	  	A1.render(V);
 	  	owlF.flush();
 	  	owlF.close();
 	
diff --git a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OnlineAlign.java b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OnlineAlign.java
index f2c2dec1..bf7e24ba 100755
--- a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OnlineAlign.java
+++ b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/OnlineAlign.java
@@ -35,10 +35,8 @@ import java.io.ByteArrayInputStream;
 import javax.swing.ProgressMonitorInputStream;
 //import javax.swing.JComponent;
 //import javax.swing.JDialog;
+import javax.swing.JOptionPane;
 import javax.swing.ProgressMonitor;
-import javax.swing.JButton;
-//import java.awt.FlowLayout;
-//import java.awt.EventQueue;
  
 import java.io.OutputStream;
 //import java.io.InputStream;
@@ -81,19 +79,10 @@ public class OnlineAlign {
 		String uploadFile = null;
 		 
 		HttpURLConnection globalConn = null;
+		HttpURLConnection globalConn2 = null;
 		 
 		String globalAnswer = null;
-		 
-		//InputStream globalInput = null;
-		JButton export = null;
-		JButton store = null;
-		JButton trim = null;
-		
-		JButton allAl = null;
-		JButton findAl = null;
-		JButton map = null;
-		 
-		
+			
 		private static DocumentBuilder BUILDER = null;
 		final DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
 		
@@ -335,8 +324,9 @@ public class OnlineAlign {
  		
 	    }
 	    
-	    public String getAlignId(String method, String onto1, String onto2) {
+	    public void getAlignId(String method, String wserver, String wsmethod, String onto1, String onto2 ) {
 	    	
+	     
 	    	String[] aservArgAlign = new String[6];		
 	    	String answer = null ;
 				 
@@ -348,27 +338,28 @@ public class OnlineAlign {
 				params.setParameter( "arg1", method);
 				params.setParameter( "arg2", onto1);
 				params.setParameter( "arg3", onto2);
+				params.setParameter( "arg4", wserver);
+				//params.setParameter( "arg5", wsmethod);
+				
 				
 			    try {
 			    	// Read parameters
 			    	// Create the SOAP message
 			    	String message = createMessage( params );
 			  
-			    	//System.out.println("URL SOAP :"+ SOAPUrl+ ",  Action:"+ SOAPAction);
-			    	//System.out.println("Message :"+ message);
-			
 			    	// Send message
-			    	answer = sendMessage( message, params );
+			    	//answer = sendMessage( message, params );
+			    	sendMessage( message, params );
 			 
 			    	//System.out.println("SOAP Match align=" + answer );
 			    	 
 			    }
 			    
 			    catch ( Exception ex ) { ex.printStackTrace(); };
+			    
+			    /*
 			    if(! connected ) return null; 
 			    
-			    // Cut SOAP header
-				//answer =  "<?xml version='1.0' encoding='utf-8' standalone='no'?>" + answer ; 
 			    Document domMessage = null;
 				try {
 				    domMessage = BUILDER.parse( new ByteArrayInputStream( answer.getBytes()) );
@@ -381,8 +372,25 @@ public class OnlineAlign {
 				
 				String result[] = getTagFromSOAP( domMessage,  "matchResponse" );
 				
-				//System.out.println("Match align Id=" + result[0]);
 			    return result[0];	 
+			    */
+			    
+	    }
+	    
+	    public String getAlignIdParsed( String input ) {
+	    	Document domMessage = null;
+			try {
+			    domMessage = BUILDER.parse( new ByteArrayInputStream( input.getBytes()) );
+			    
+			} catch  ( IOException ioex ) {
+			    ioex.printStackTrace();
+			} catch  ( SAXException saxex ) {
+			    saxex.printStackTrace();
+			}
+			
+			String result[] = getTagFromSOAP( domMessage,  "matchResponse" );
+			
+		    return result[0];	 
 	    }
 	    
 		
@@ -456,16 +464,9 @@ public class OnlineAlign {
  			return result[0];
 	    }
 	    
-	    public void getRDFAlignment(String alignId, JButton exp, JButton st, JButton tr, 
-	    							JButton al, JButton fi, JButton mp ) {
+	    public void getRDFAlignment(String alignId ) {
 			
 			//retrieve alignment for storing in OWL file
-			export = exp;
-			store  = st;
-			trim   = tr;
-		    allAl  = al;
-		    findAl = fi;
-		    map    = mp;
 			 
 	    	Parameters params = new BasicParameters();
 	    	params = new BasicParameters();
@@ -649,6 +650,7 @@ public class OnlineAlign {
 		    SOAPAction = "matchRequest";
 		    String uri1 = (String)params.getParameter( "arg1" );
 		    String uri2 = (String)params.getParameter( "arg2" );
+		    String wserver = (String)params.getParameter( "arg4" );
 		    //if ( uri2 == null ){
 			//usage();
 			//System.exit(-1);
@@ -658,13 +660,18 @@ public class OnlineAlign {
 		    if ( arg3 != null ) {
 			method = uri1; uri1 = uri2; uri2 = arg3;
 		    }
-		    arg3 = (String)params.getParameter( "arg4" );
+		    //arg3 = (String)params.getParameter( "arg4" );
 		    messageBody = "<url1>"+uri1+"</url1><url2>"+uri2+"</url2>";
+		    
 		    if ( method != null )
 			messageBody += "<method>"+method+"</method>";
+		    if ( wserver != null )
+		    messageBody += "<wserver>"+ wserver +"</wserver>";
+		    
+		    messageBody += "<force>on</force>";
 		    //fr.inrialpes.exmo.align.impl.method.SubsDistNameAlignment
-		    if ( arg3 != null )
-			messageBody += "<force>"+arg3+"</force>";
+		    //if ( arg3 != null )
+			
 		} else if ( cmd.equals("trim" ) ) {
 		    SOAPAction = "cutRequest";
 		    String id = (String)params.getParameter( "arg1" );
@@ -772,22 +779,134 @@ public class OnlineAlign {
 	        	HttpURLConnection httpConn = (HttpURLConnection) connection;
 	        	globalConn = httpConn;
 	        	 
-	            httpConn.setRequestProperty( "Content-Length",
+	            globalConn.setRequestProperty( "Content-Length",
 	                                         String.valueOf( b.length ) );
-	            httpConn.setRequestProperty("Content-Type","text/xml; charset=utf-8");
- 	            httpConn.setRequestProperty("SOAPAction",SOAPAction);
-	            httpConn.setRequestMethod( "POST" );
-	            httpConn.setDoOutput(true);
-	            httpConn.setDoInput(true);
-
+	            globalConn.setRequestProperty("Content-Type","text/xml; charset=utf-8");
+	            globalConn.setRequestProperty("SOAPAction",SOAPAction);
+	            globalConn.setRequestMethod( "POST" );
+	            globalConn.setDoOutput(true);
+	            globalConn.setDoInput(true);
+	        	 
 	            // Send the request through the connection
-	            OutputStream out = httpConn.getOutputStream();
+	            OutputStream out = globalConn.getOutputStream();
 	            
 	            out.write( b );
 	        	out.close();
 	        
-	            
-				if(  param.getParameter("command").equals("retrieve") ) {
+	        	if( param.getParameter("command").equals("match") ) {
+					
+					globalAnswer = "";
+					Thread th = new Thread() {
+						
+		        		public void run() {
+		        		ProgressMonitor pm = null;
+		        		
+					    try {
+				    	
+					    	//JOptionPane.showMessageDialog(null, "Matching ontologies may be long.","Warning",2);
+					    	
+					    	InputStreamReader isr = new InputStreamReader( globalConn.getInputStream() );
+					    	BufferedReader in = new BufferedReader(isr); 
+					    	String line;
+					    	 
+					    	String alignRes = ""; 
+					    	 
+					    	while ((line = in.readLine()) != null) {
+					    		alignRes += line + "\n";
+					    	}
+					    	
+					    	String alignId = getAlignIdParsed( alignRes );
+					    	
+					    	if(alignId == null || alignId.equals(""))  {
+					    		JOptionPane.showMessageDialog(null, "Alignment is not produced.","Warning",2);
+					    		SWTInterface.set3Buttons();
+					    		return;
+					    	}
+					    	
+					    	SWTInterface.resetAlignList( alignId );
+					    	globalConn.disconnect();
+					    	
+					    	URLConnection connection2 = SOAPUrl.openConnection();
+				        	globalConn2 = (HttpURLConnection) connection2;
+				         	
+					    	//To fetch alignment from alignId
+					    	Parameters params = new BasicParameters();
+					    	params = new BasicParameters();
+					    	params.setParameter( "host", HOST );
+					    	params.setParameter( "command","retrieve");
+					    	params.setParameter( "arg1", alignId);
+					    	params.setParameter( "arg2", "fr.inrialpes.exmo.align.impl.renderer.RDFRendererVisitor");
+					    	//SOAPAction is updated
+					    	String message = createMessage( params );
+					    	byte[] bb = message.getBytes();
+					    	 
+					    	globalConn2.setRequestProperty( "Content-Length",
+                                    String.valueOf( bb.length ) );
+					    	globalConn2.setRequestProperty("Content-Type","text/xml; charset=utf-8");
+					    	globalConn2.setRequestProperty("SOAPAction",SOAPAction);
+					    	globalConn2.setRequestMethod( "POST" );
+					    	globalConn2.setDoOutput(true);
+					    	globalConn2.setDoInput(true);
+
+					    	// Send the request through the connection
+					    	OutputStream out2 = globalConn2.getOutputStream();
+       
+					    	out2.write( bb );
+					    	out2.close();
+					    	
+					    	int maxSize = 5000000;
+					    	ProgressMonitor pm2 = null;
+					    	String mess = "Fetching alignment from server...";
+					    	try {
+					    		ProgressMonitorInputStream pin2 = new ProgressMonitorInputStream( null, mess, globalConn2.getInputStream() );
+					    		pm2 = pin2.getProgressMonitor();
+					    		pm2.setMaximum( maxSize );
+					    		pm2.setMillisToPopup( 1 ); 
+					    		pm2.setMillisToDecideToPopup( 2 ); 
+					    	
+					    		InputStreamReader isr2 = new InputStreamReader(pin2);
+					    		BufferedReader in2 = new BufferedReader(isr2);
+					    	 
+					    		//String line;
+					    		int co = 0;
+					    	
+					    		while ((line = in2.readLine()) != null) {
+					    			globalAnswer += line + "\n";
+					    			co += line.length();
+					    			pm2.setNote(co + " bytes read.");
+					    			if( co >= maxSize -10000 ) { 
+					    				maxSize = co + line.length() + maxSize; 
+					    				pm2.setMaximum( maxSize );
+					    				pm2.setProgress( co );
+					    			}
+					    		}
+					    	
+					    		SWTInterface.resetActionButtons( true );
+	 			    	
+					    		pm2.setProgress( maxSize - 1 );
+					    		pin2.close();
+					    	} catch (Exception e) {
+						    	
+						    	if( pm2.isCanceled()) {
+						    		SWTInterface.set3Buttons();
+					    		}
+						    	e.printStackTrace();
+						    	}
+				            
+					    } catch (Exception e) {
+					    	
+					    	if( pm.isCanceled() ) {
+					    		SWTInterface.set3Buttons();
+				    			 
+				    		}
+					    	e.printStackTrace();
+					    	}
+					    }
+					};
+					
+					th.start();
+					 
+				} else if( param.getParameter("command").equals("retrieve") ) { //|| param.getParameter("command").equals("match")) {
 					
 					globalAnswer = "";
 					Thread th = new Thread() {
@@ -821,24 +940,16 @@ public class OnlineAlign {
 					    			pm.setMaximum( maxSize );
 					    			pm.setProgress( co );
 					    		}
-					    		
 					    	}
 					    	
-							export.setEnabled(true);
-	    					store.setEnabled(true);
-	    					trim.setEnabled(true);
-	    					allAl.setEnabled(true);
-    						findAl.setEnabled(true);
-    						map.setEnabled(true);
+					    	SWTInterface.resetActionButtons( true );
 	 			    	
 					    	pm.setProgress( maxSize - 1 );
 				            pin.close();
 					    } catch (Exception e) {
 					    	
 					    	if( pm.isCanceled() ) {
-				    			allAl.setEnabled(true);
-	    						findAl.setEnabled(true);
-	    						map.setEnabled(true);
+					    		SWTInterface.set3Buttons( );
 				    		}
 					    	e.printStackTrace();
 					    	}
diff --git a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/SWTInterface.java b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/SWTInterface.java
index 987e7f4e..8cd5cad8 100644
--- a/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/SWTInterface.java
+++ b/plugins/neon/src/fr/inrialpes/exmo/align/plugin/neontk/SWTInterface.java
@@ -142,7 +142,7 @@ public class SWTInterface extends JPanel {
 	private static JSplitPane _mainSplitter = new JSplitPane (JSplitPane.VERTICAL_SPLIT);
 	
 	 
-	JLabel hostName, portName;//, thresLabel;//, alignProjLabel;
+	JLabel hostName, portName, serverName, methodName;//, alignProjLabel;
 	
 	//JComboBox hostList, portList;
 	
@@ -150,44 +150,44 @@ public class SWTInterface extends JPanel {
 	String selectedPort  =  null;
 	String selectedOnto1 =  null;
 	String selectedOnto2 =  null;
-	String selectedAlign =  null;
+	
 	String selectedLocalAlign =  null;
-	//String selectedNeOnOnto1  =  null;
-	//String selectedNeOnOnto2  =  null;
+	static String selectedAlign =  null;
 	
 	public static Hashtable<String,Alignment>  alignmentTable = new Hashtable<String,Alignment>();
 	static String [] forUniqueness = new String[0];
 	static int alignId = 0;
  
-	JComponent phrases;// Res=null;
+	JComponent phrases;
 	
-    JTextField fileName1, fileName2, hostField, portField;  
+    JTextField fileName1, fileName2, hostField, portField, serverField, methodField;  
     SWTInterface frame;
      
     JEditorPane htmlView;
     
-    JButton cancelButton, mapButton, fetchButton, resButton, ontoRefresh, allAlignButton,
-    		alignImportButton,  localAlignImportButton, alignUploadButton, 
-    		localAlignTrimButton, serverAlignTrimButton, alignFindButton, 
-    		alignStoreButton, connButton, offlineButton, onlineButton;// disconnButton ;
-    JDialog dialog; 
+    JButton cancelButton, discardButton,  fetchButton, resButton, ontoRefresh,
+    		localAlignImportButton, alignUploadButton, 
+    		localAlignTrimButton, connButton, goButton, offlineButton, onlineButton;
+    
+    static JButton alignStoreButton, alignImportButton, serverAlignTrimButton, mapButton, alignFindButton, allAlignButton;
+    
+    JDialog connDialog, matchDialog; 
     //JPanel pane2;
 	Component result = null;
-    JComboBox strategy, renderer, alignBox, localAlignBox, ontoBox1, ontoBox2;
+    JComboBox strategy, renderer, localAlignBox, ontoBox1, ontoBox2;
+    static JComboBox alignBox;
     JLabel strat, render, ontoLabel1, ontoLabel2, alignLabel, localAlignLabel;
      
     //lists obtained from from server
     public String [] methodList = new String[0];
     
-    
     //lists obtained from Neontk
     public String [] ontoList = new String[0];
     public HashMap<String,String> onto_proj = new HashMap<String,String>(0); 
     //public String [] NeOnOntoList = new String[0];
-    public String [] alignIdList = new String[0];
+    public static String [] alignIdList = new String[0];
     public String [] localAlignIdList = new String[0];
    
-    
     public Vector	 corrList = new Vector();
     public String [] aservArgs = null;
     public String [] aservArgRetrieve = null;
@@ -201,6 +201,8 @@ public class SWTInterface extends JPanel {
     //String defaultPort = "8089";
     String defaultPort = "80";
     String matchMethod = "fr.inrialpes.exmo.align.impl.method.NameEqAlignment";
+    String wserver = "http://kameleon.ijs.si/ontolight/ontolight.asmx";
+    String wsmethod="";
     //rethink
     
 	String alignProject = "AlignmentProject";
@@ -246,7 +248,6 @@ public class SWTInterface extends JPanel {
 		
 		offlineButton.setEnabled(false);
 		 
-		
 		strategy.removeAllItems();
 		alignBox.removeAllItems();
 		localAlignBox.removeAllItems();
@@ -329,6 +330,33 @@ public class SWTInterface extends JPanel {
 	   return alignId;
 	}
 	
+	public static void resetAlignList(String alignId) {
+		
+		alignIdList = new String[1];
+		alignIdList[0] = alignId;
+		selectedAlign = alignIdList[0];
+		if(alignBox.getItemCount() > 0) alignBox.removeAllItems();
+		alignBox.addItem(selectedAlign);
+		    
+		}
+	
+	public static void resetActionButtons( boolean flag ) {
+		
+		alignImportButton.setEnabled( flag );
+		alignStoreButton.setEnabled( flag );
+		serverAlignTrimButton.setEnabled( flag );
+		mapButton.setEnabled( flag );
+		alignFindButton.setEnabled( flag );
+		allAlignButton.setEnabled( flag );
+	
+		}
+	
+	public static void set3Buttons( ) { 
+		mapButton.setEnabled( true );
+		alignFindButton.setEnabled( true );
+		allAlignButton.setEnabled( true );
+		}
+	
     public void initialize() {
 
 	//selectedHost = "aserv.inrialpes.fr";
@@ -370,16 +398,14 @@ public class SWTInterface extends JPanel {
     		if (e.getSource() == onlineButton) {
     			online = true;
     			
-    			
 				JOptionPane pane = new JOptionPane();
-				dialog = pane.createDialog(null, "Input for connection");
-				dialog.setSize(new Dimension(300,120));
+				connDialog = pane.createDialog(null, "Input for connection");
+				connDialog.setSize(new Dimension(300,120));
 				
-				Container cont = dialog.getContentPane();
+				Container cont = connDialog.getContentPane();
 				Component[] comps = cont.getComponents();
 				for(int i=0;i< comps.length ;i++) { cont.remove(comps[i]);}
 				
-				 
 				cont.add(connButton);
 				cont.add(cancelButton);
 				
@@ -390,10 +416,8 @@ public class SWTInterface extends JPanel {
 			    jPane.add(connButton); 	 
 			    jPane.add(cancelButton);
 			     
-				dialog.setContentPane(jPane);
-				dialog.setVisible(true);
-				
-				
+				connDialog.setContentPane(jPane);
+				connDialog.setVisible(true);	
     		}
     	
         };
@@ -411,6 +435,16 @@ public class SWTInterface extends JPanel {
 	portField.setEnabled(true);
 	portField.setEditable( true );
 	
+	serverName = new JLabel( "wserver" );
+	serverField = new JTextField( wserver , 50 );
+	serverField.setEnabled(true);
+	serverField.setEditable( true );
+	
+	methodName = new JLabel( "wsmethod" );
+	methodField = new JTextField( "", 50 );
+	methodField.setEnabled(true);
+	methodField.setEditable( true );
+	
 	connButton = new JButton("Connect",null);
 	connButton.setEnabled(true);
 
@@ -472,7 +506,7 @@ public class SWTInterface extends JPanel {
     				
     				online = true;
     				
-        			dialog.dispose();			
+        			connDialog.dispose();			
         			
 				    } 
             	
@@ -486,7 +520,19 @@ public class SWTInterface extends JPanel {
 	    public void actionPerformed(ActionEvent e) {
 	    		if (e.getSource() == cancelButton) {
 	    			//System.out.println("Cancel");
-	    			dialog.dispose();
+	    			connDialog.dispose();
+	    			
+	    		}
+	    };
+	    });
+	
+	discardButton = new JButton("Discard",null);
+	discardButton.setEnabled(true);
+	discardButton.addActionListener(new ActionListener(){
+	    public void actionPerformed(ActionEvent e) {
+	    		if (e.getSource() == discardButton) {
+	    			//System.out.println("Cancel");
+	    			matchDialog.dispose();
 	    			
 	    		}
 	    };
@@ -630,12 +676,7 @@ public class SWTInterface extends JPanel {
 	fetchButton.addActionListener(new ActionListener(){
 		public void actionPerformed(ActionEvent e) {
 				
-			    fetchButton.setEnabled(false);
-			    mapButton.setEnabled(false);
-			    allAlignButton.setEnabled(false);
-    			alignFindButton.setEnabled(false);
-				//alignStoreButton.setEnabled(false); 
-				//serverAlignTrimButton.setEnabled(false);
+			    resetActionButtons( false );
     				
         		if (e.getSource() == fetchButton) {
         			
@@ -648,8 +689,7 @@ public class SWTInterface extends JPanel {
 					alignIdList[0] = selectedAlign;
 					alignBox.removeAllItems();
 					alignBox.addItem(selectedAlign);
-					onAlign.getRDFAlignment( selectedAlign, alignImportButton, alignStoreButton, 
-							                 serverAlignTrimButton, allAlignButton, alignFindButton, mapButton);
+					onAlign.getRDFAlignment( selectedAlign );
         			
         		} 
 	};
@@ -1043,7 +1083,42 @@ public class SWTInterface extends JPanel {
 		};
         });
 	
-	
+	goButton = new JButton("Accept",null);	
+	goButton.setEnabled( true );
+	goButton.addActionListener(new ActionListener(){
+		public void actionPerformed(ActionEvent e) {
+		   if (e.getSource() == goButton) {
+ 
+			   matchDialog.dispose();
+			   
+			   resetActionButtons( false );
+   			   
+			   onAlign.getAlignId( matchMethod, wserver, wsmethod, selectedOnto1, selectedOnto2 );
+			   
+			   
+			   
+			   //String answer = onAlign.getAlignIdParsed();
+			   //if(answer == null || answer.equals(""))  {
+					 
+				//	JOptionPane.showMessageDialog(null, "Alignment is not produced.","Warning",2);
+				//	return;
+				//}
+				
+				//alignIdList = new String[1];
+				//alignIdList[0] = answer;
+				//selectedAlign = alignIdList[0];
+				//alignBox.removeAllItems();
+				//alignBox.addItem(selectedAlign);
+				
+				//onAlign.getRDFAlignment( selectedAlign, alignImportButton, alignStoreButton, 
+				//		                 serverAlignTrimButton, allAlignButton, alignFindButton, mapButton);
+				
+		   } // getsource
+		    
+		};
+	});
+		   
+		   
 	mapButton = new JButton("Match",null);	
 	mapButton.setEnabled(false);
 	mapButton.addActionListener(new ActionListener(){
@@ -1060,31 +1135,44 @@ public class SWTInterface extends JPanel {
 				   			JOptionPane.showMessageDialog(null, "URLs for ontologies are required.  ","Warning",2);
 				   			return;
 				   		}
-				   		
-				   		alignImportButton.setEnabled(false);
-	        			alignStoreButton.setEnabled(false);
-	        			serverAlignTrimButton.setEnabled(false);
-	        			allAlignButton.setEnabled(false);
-	        			alignFindButton.setEnabled(false);
-	        			mapButton.setEnabled(false);
-	        			 
-				   		//if (matchMethod.equals("es.upm.fi.dia.ontology.semanticmapper.pronto.ODEAlignment")) {
-				   		//	JOptionPane.showMessageDialog(null, "This method may take some minutes.\n Please click OK and wait.","Warning",2);
-				   			
-				   		//}
-				   		
-					    String answer = onAlign.getAlignId( matchMethod, selectedOnto1, selectedOnto2  );
-						if(answer==null || answer.equals(""))  {
-							JOptionPane.showMessageDialog(null, "Alignment is not produced.","Warning",2);
-							return;
-						}
-						alignIdList = new String[1];
-						alignIdList[0] = answer;
-						selectedAlign = alignIdList[0];
-						alignBox.removeAllItems();
-						alignBox.addItem(selectedAlign);
-						onAlign.getRDFAlignment( selectedAlign, alignImportButton, alignStoreButton, 
-								                 serverAlignTrimButton, allAlignButton, alignFindButton, mapButton);
+				   		if( matchMethod.equals("fr.inrialpes.exmo.align.service.WSAlignment")) {
+				   			JOptionPane pa = new JOptionPane();
+				   			matchDialog = pa.createDialog(null, "Parameters for matching");
+				   			matchDialog.setSize(new Dimension(400,120));
+	    				
+				   			Container cont = matchDialog.getContentPane();
+				   			Component[] comps = cont.getComponents();
+				   			for(int i=0;i< comps.length ;i++) { cont.remove(comps[i]);}
+	    				
+	    				 
+				   			cont.add(goButton);
+				   			cont.add(discardButton);
+	    				
+				   			JPanel jPane = new JPanel (new GridLayout (3, 2, 20, 10));
+	    				      
+				   			jPane.add(serverName); jPane.add(serverField);
+				   			jPane.add(methodName); jPane.add(methodField);
+				   			jPane.add(goButton); 	 
+				   			jPane.add(discardButton);
+	    			     
+				   			matchDialog.setContentPane(jPane);
+				   			matchDialog.setVisible(true);
+				   		} else {
+				   			resetActionButtons( false );
+							onAlign.getAlignId( matchMethod, wserver, wsmethod, selectedOnto1, selectedOnto2 );
+				   		}
+					    //String answer = onAlign.getAlignId( matchMethod, selectedOnto1, selectedOnto2  );
+						//if(answer==null || answer.equals(""))  {
+						//	JOptionPane.showMessageDialog(null, "Alignment is not produced.","Warning",2);
+						//	return;
+						//}
+						//alignIdList = new String[1];
+						//alignIdList[0] = answer;
+						//selectedAlign = alignIdList[0];
+						//alignBox.removeAllItems();
+						//alignBox.addItem(selectedAlign);
+						//onAlign.getRDFAlignment( selectedAlign, alignImportButton, alignStoreButton, 
+						//		                 serverAlignTrimButton, allAlignButton, alignFindButton, mapButton);
 						 		 
 				  }
 				  else { //offline
@@ -1114,6 +1202,7 @@ public class SWTInterface extends JPanel {
     
     ontoLabel1 = new JLabel("Ontology 1           ");
     ontoBox1  = new JComboBox(ontoList);
+    ontoBox1.setEditable( true );
     ontoBox1.setEnabled(false);
     ontoBox1.setMaximumRowCount(20);
     ontoBox1.addItemListener(new ItemListener() {
@@ -1121,9 +1210,9 @@ public class SWTInterface extends JPanel {
 		{
 	      int id = 0;
 		  if (event.getStateChange()==ItemEvent.SELECTED)
-			id = ontoBox1.getSelectedIndex();
-		    
-		    selectedOnto1 =  ontoList[id];
+			//id = ontoBox1.getSelectedIndex();
+			selectedOnto1 = (String)ontoBox1.getSelectedItem();
+		    //selectedOnto1 =  ontoList[id];
 		    //selectedNeOnOnto1 =  NeOnOntoList[id];
 		    
 		   
@@ -1133,6 +1222,7 @@ public class SWTInterface extends JPanel {
     
     ontoLabel2 = new JLabel("Ontology 2           ");
     ontoBox2  = new JComboBox(ontoList);
+    ontoBox2.setEditable( true );
     ontoBox2.setEnabled(false);
     ontoBox2.setMaximumRowCount(20);
     ontoBox2.addItemListener(new ItemListener() {
@@ -1140,12 +1230,10 @@ public class SWTInterface extends JPanel {
 		{
 	      int id = 0;
 		  if (event.getStateChange()==ItemEvent.SELECTED)
-			id = ontoBox2.getSelectedIndex();
-		    
-		    selectedOnto2 =  ontoList[id];
+			//id = ontoBox2.getSelectedIndex();
+			selectedOnto2 = (String)ontoBox2.getSelectedItem();
+		    //selectedOnto2 =  ontoList[id];
 		    //selectedNeOnOnto2 =  NeOnOntoList[id];
-		    
-		   
 		   // System.out.println("Onto2 selected =" + selectedOnto2);
 		}
 	});
-- 
GitLab