Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 58634 Details for
Bug 150385
Dependency on Apache Muse libraries for WSDM support in TPTP
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Mechanism to point to axis2
patch_CodeGen_150385.txt (text/plain), 62.28 KB, created by
Balan Subramanian
on 2007-02-09 01:45:33 EST
(
hide
)
Description:
Mechanism to point to axis2
Filename:
MIME Type:
Creator:
Balan Subramanian
Created:
2007-02-09 01:45:33 EST
Size:
62.28 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.wsdm.editor >Index: src/org/eclipse/tptp/wsdm/tooling/wizard/mrt/internal/CapabilitySelectionWizardPage.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/wizard/mrt/internal/CapabilitySelectionWizardPage.java,v >retrieving revision 1.1 >diff -u -r1.1 CapabilitySelectionWizardPage.java >--- src/org/eclipse/tptp/wsdm/tooling/wizard/mrt/internal/CapabilitySelectionWizardPage.java 1 Feb 2007 05:04:37 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/wizard/mrt/internal/CapabilitySelectionWizardPage.java 5 Feb 2007 06:26:39 -0000 >@@ -13,6 +13,7 @@ > package org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal; > > import java.util.Arrays; >+import java.util.Iterator; > import java.util.LinkedList; > import java.util.List; > >@@ -101,15 +102,11 @@ > { > public void checkStateChanged(CheckStateChangedEvent event) > { >- _selectedCapabilities.clear(); >- Object[] checkedElements = _capsViewer.getCheckedElements(); >- for (int i = 0; i < checkedElements.length; i++) >- { >- if (checkedElements[i] instanceof Capability) >- _selectedCapabilities.add(checkedElements[i]); >- } >- } >- }); >+ //_selectedCapabilities.clear(); >+ Object selectedelement = event.getElement(); >+ setCheckStatus(selectedelement, event.getChecked()); >+ >+ }}); > } > > /* >@@ -118,6 +115,7 @@ > public void setContainer(String container) > { > this._containerName = container; >+ > } > > private boolean showOkDialog(String title, String msg, int dlgType) >@@ -130,9 +128,68 @@ > > public Capability[] getSelectedCapabilities() > { >- return (Capability[]) _selectedCapabilities >- .toArray(new Capability[_selectedCapabilities.size()]); >+ return (Capability[]) _selectedCapabilities.toArray(new Capability[_selectedCapabilities.size()]); > } > >+ private void setCheckStatus(Object selElement, boolean checkState) { >+ Object[] checkedElements = _capsViewer.getCheckedElements(); >+ if(selElement instanceof Capability){ >+ Capability selCapability = (Capability)selElement; >+ >+ // add/remove the capability from the _selectedCapabilities >+ boolean found = false; >+ for (Iterator it = _selectedCapabilities.iterator(); it.hasNext();) { >+ Capability cap = (Capability)it.next(); >+ if(selCapability.equals(cap)){ >+ found = true; >+ break; >+ } >+ } >+ if(!found && checkState){ >+ _selectedCapabilities.add(selCapability); >+ }else if(found && !checkState){ >+ _selectedCapabilities.remove(selCapability); >+ } >+ >+ Object parent = _contentProvider.getParent(selElement); >+ if (_capsViewer.getChecked(parent) && !checkState){ >+ _capsViewer.setChecked(parent, false); >+ } >+ else if(!_capsViewer.getChecked(parent) && checkState && allChildrenChecked(parent)){ >+ _capsViewer.setChecked(parent, true); >+ } >+ _capsViewer.setChecked(selElement,checkState); >+ }else if(selElement instanceof Category){ >+ // if the Category is selected >+ Category selCategory = (Category) selElement; >+ >+ Object[] categoryList = _contentProvider.getChildren(_capsViewer.getInput()); >+ for (int j=0; j< categoryList.length; j++) { >+ Category category = (Category) categoryList[j]; >+ if (category.getName().equals(selCategory.getName())) { >+ Object[] capabilities = _contentProvider.getChildren(category); >+ if (capabilities.length > 0) { >+ for (int caps=0; caps<capabilities.length; caps++){ >+ setCheckStatus(capabilities[caps], checkState); >+ } >+ } else _capsViewer.setChecked(selElement,false); >+ } >+ } >+ } >+ } >+ >+ private boolean allChildrenChecked(Object parent) { >+ boolean allChecked = true; >+ Object[] children = _contentProvider.getChildren(parent); >+ if (children.length > 0) { >+ for (int i=0; i<children.length; i++) { >+ if (!_capsViewer.getChecked(children[i])) >+ allChecked = false; >+ } >+ } >+ else return false; >+ return allChecked; >+ } >+ > } // end class NewMr3WizardPage > >Index: src/org/eclipse/tptp/wsdm/tooling/wizard/mrt/internal/CapabilitySelectionDialog.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/wizard/mrt/internal/CapabilitySelectionDialog.java,v >retrieving revision 1.1 >diff -u -r1.1 CapabilitySelectionDialog.java >--- src/org/eclipse/tptp/wsdm/tooling/wizard/mrt/internal/CapabilitySelectionDialog.java 1 Feb 2007 05:04:37 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/wizard/mrt/internal/CapabilitySelectionDialog.java 5 Feb 2007 06:26:38 -0000 >@@ -13,6 +13,7 @@ > package org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal; > > import java.util.Arrays; >+import java.util.Iterator; > import java.util.LinkedList; > import java.util.List; > >@@ -20,8 +21,10 @@ > import org.eclipse.jface.action.Action; > import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.viewers.CheckStateChangedEvent; > import org.eclipse.jface.viewers.CheckboxTreeViewer; > import org.eclipse.jface.viewers.DoubleClickEvent; >+import org.eclipse.jface.viewers.ICheckStateListener; > import org.eclipse.jface.viewers.IDoubleClickListener; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredSelection; >@@ -53,7 +56,7 @@ > private CheckboxTreeViewer _capsViewer; > private CapsTreeContentProvider _contentProvider; > >- private List SELECTED_WSDLS = new LinkedList(); >+ private List _selectedCapabilities = new LinkedList(); > > /* > * Constructor which sets the selected capabilities and containerName >@@ -136,7 +139,7 @@ > for (int i = 0; i < checkedElements.length; i++) > { > if (checkedElements[i] instanceof Capability) >- SELECTED_WSDLS.add(checkedElements[i]); >+ _selectedCapabilities.add(checkedElements[i]); > } > super.okPressed(); > } >@@ -144,11 +147,9 @@ > /* > * Return the selected capabilities > */ >- public Capability[] getSelectedCaps() >- { >- return (Capability[]) SELECTED_WSDLS >- .toArray(new Capability[SELECTED_WSDLS.size()]); >- } >+ public Capability[] getSelectedCaps() { >+ return (Capability[]) _selectedCapabilities.toArray(new Capability[_selectedCapabilities.size()]); >+ } > > private void hookAllListeners() > { >@@ -172,6 +173,74 @@ > { > doubleClickAction.run(); > } >+ }); >+ >+ _capsViewer.addCheckStateListener(new ICheckStateListener() { >+ public void checkStateChanged(CheckStateChangedEvent event) { >+ Object element = event.getElement(); >+ setCheckStatus(element, event.getChecked()); >+ getButton(IDialogConstants.OK_ID).setEnabled(_capsViewer.getCheckedElements().length!=0); >+ } > }); > } >+ private void setCheckStatus(Object selElement, boolean checkState) { >+ Object[] checkedElements = _capsViewer.getCheckedElements(); >+ if(selElement instanceof Capability){ >+ Capability selCapability = (Capability)selElement; >+ >+ // add/remove the capability from the _selectedCapabilities >+ boolean found = false; >+ for (Iterator it = _selectedCapabilities.iterator(); it.hasNext();) { >+ Capability cap = (Capability)it.next(); >+ if(selCapability.equals(cap)){ >+ found = true; >+ break; >+ } >+ } >+ if(!found && checkState){ >+ _selectedCapabilities.add(selCapability); >+ }else if(found && !checkState){ >+ _selectedCapabilities.remove(selCapability); >+ } >+ >+ Object parent = _contentProvider.getParent(selElement); >+ if (_capsViewer.getChecked(parent) && !checkState){ >+ _capsViewer.setChecked(parent, false); >+ } >+ else if(!_capsViewer.getChecked(parent) && checkState && allChildrenChecked(parent)){ >+ _capsViewer.setChecked(parent, true); >+ } >+ _capsViewer.setChecked(selElement,checkState); >+ }else if(selElement instanceof Category){ >+ // if the Category is selected >+ Category selCategory = (Category) selElement; >+ >+ Object[] categoryList = _contentProvider.getChildren(_capsViewer.getInput()); >+ for (int j=0; j< categoryList.length; j++) { >+ Category category = (Category) categoryList[j]; >+ if (category.getName().equals(selCategory.getName())) { >+ Object[] capabilities = _contentProvider.getChildren(category); >+ if (capabilities.length > 0) { >+ for (int caps=0; caps<capabilities.length; caps++){ >+ setCheckStatus(capabilities[caps], checkState); >+ } >+ } else _capsViewer.setChecked(selElement,false); >+ } >+ } >+ >+ } >+ } >+ >+ private boolean allChildrenChecked(Object parent) { >+ boolean allChecked = true; >+ Object[] children = _contentProvider.getChildren(parent); >+ if (children.length > 0) { >+ for (int i=0; i<children.length; i++) { >+ if (!_capsViewer.getChecked(children[i])) >+ allChecked = false; >+ } >+ } >+ else return false; >+ return allChecked; >+ } > } >Index: src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/Messages.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/Messages.java,v >retrieving revision 1.1 >diff -u -r1.1 Messages.java >--- src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/Messages.java 1 Feb 2007 05:04:44 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/Messages.java 5 Feb 2007 06:26:38 -0000 >@@ -123,6 +123,20 @@ > public static String CODE_GEN_PROJECT_DIR; > public static String CODE_GEN_LOCATION_ERROR; > public static String CODE_GEN_DIR_LOCATION; >+ public static String CODE_GEN_AXIS2_LOCATION; >+ public static String CODE_GEN_UPDATE_PREF; >+ public static String CODE_GEN_START; >+ public static String CODE_GEN_STEP1; >+ public static String CODE_GEN_STEP2; >+ public static String CODE_GEN_STEP3; >+ public static String CODE_GEN_FAILED_ERROR; >+ public static String CODE_GEN_SUBTASK1; >+ public static String CODE_GEN_SUBTASK2; >+ public static String CODE_GEN_SUBTASK3; >+ public static String CODE_GEN_PROJECTIZER; >+ public static String CODE_GEN_ERROR_AXIS2; >+ public static String FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_; >+ public static String CODE_GEN_VALIDATE_SLOCATION; > > static > { >Index: src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties,v >retrieving revision 1.1 >diff -u -r1.1 messages.properties >--- src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties 1 Feb 2007 05:04:43 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties 5 Feb 2007 06:26:38 -0000 >@@ -118,3 +118,17 @@ > CODE_GEN_PROJECT_DIR = Project contents directory must be specified > CODE_GEN_LOCATION_ERROR = Invalid location path > CODE_GEN_DIR_LOCATION = Select the location directory. >+CODE_GEN_AXIS2_LOCATION = Server Installation Location >+CODE_GEN_UPDATE_PREF = Update Preferences >+CODE_GEN_START = Working: >+CODE_GEN_STEP1 = Initializing Code Generation >+CODE_GEN_STEP2 = Merging WSDL >+CODE_GEN_STEP3 = Creating project >+CODE_GEN_FAILED_ERROR = Code generation failed, see Error Log >+CODE_GEN_SUBTASK1 = Running Analyzer >+CODE_GEN_SUBTASK2 = Running Synthesizer >+CODE_GEN_SUBTASK3 = Running Projectizer >+CODE_GEN_PROJECTIZER = Projectizer: >+CODE_GEN_ERROR_AXIS2 = Invalid Axis2 Server Location >+FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_ = IWAT0682E Failed to initialize muse descriptor >+CODE_GEN_VALIDATE_SLOCATION = Validating the Server Location >\ No newline at end of file >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/NewProjectWizard.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/NewProjectWizard.java,v >retrieving revision 1.1 >diff -u -r1.1 NewProjectWizard.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/NewProjectWizard.java 1 Feb 2007 05:04:44 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/NewProjectWizard.java 5 Feb 2007 06:26:35 -0000 >@@ -21,6 +21,7 @@ > import org.apache.muse.tools.generator.synthesizer.ServerSynthesizer; > import org.apache.muse.tools.generator.synthesizer.Synthesizer; > import org.apache.muse.tools.generator.util.ConfigurationData; >+import org.apache.ws.muse.descriptor.AdditionalJarsType; > import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.ILog; >@@ -55,6 +56,8 @@ > > private GenerationOptionsPage _generationOptionsPage; > >+ private GenerationProjectPage _generationProjectPage; >+ > private String _projectName; > > private boolean _overwrite; >@@ -73,11 +76,14 @@ > > private DescriptorHelper _helper; > >+ private String _serverLocation; >+ >+ private boolean _isAxis2Project; >+ > public NewProjectWizard(CodeGenerationDelegate codeGenerationDelegate) > { > setWindowTitle(Messages.HOOKUP_WIZARD_TXT7); > setNeedsProgressMonitor(true); >- > _codeGenerationDelegate = codeGenerationDelegate; > } > >@@ -85,6 +91,8 @@ > { > _generationOptionsPage = new GenerationOptionsPage(); > addPage(_generationOptionsPage); >+ _generationProjectPage = new GenerationProjectPage(); >+ addPage(_generationProjectPage); > > // TODO AME why is this hardcoded here? why is it getting reloaded? > Image imgTP = EclipseUtils.loadImage(PlatformUI.getWorkbench() >@@ -99,14 +107,51 @@ > { > try > { >- monitor.beginTask("Working: ", 6); >+ monitor.beginTask(Messages.CODE_GEN_START, 6); >+ String[] axis2files = {"lib/axis2-adb-1.1.1.jar", >+ "lib/axis2-codegen-1.1.1.jar","lib/axis2-java2wsdl-1.1.1.jar", >+ "lib/axis2-tools-1.1.1.jar"}; >+ >+ if(_isAxis2Project){ >+ try{ >+ // Step 1: Validate the server path >+ monitor.subTask(Messages.CODE_GEN_VALIDATE_SLOCATION); >+ if((new File(_serverLocation)).exists()){ >+ //TODO Nalini >+ // Step 2 : Update the Preferences, if needed >+ // Step 3 : Check for Axis2 installation libraries >+ boolean found = true; >+ for(int i = 0 ; i < axis2files.length ; i++){ >+ File axisFile = new File(_serverLocation+ File.separator+axis2files[i]); >+ if(axisFile.exists()) >+ continue; >+ else{ >+ found = false; >+ break; >+ } >+ } >+ if(!found){ >+ return; >+ } >+ }else{ >+ throw new InvocationTargetException(new Exception(Messages.CODE_GEN_ERROR_AXIS2)); >+ } >+ >+ }catch(Exception e){ >+ throw new RuntimeException(e); >+ } >+ } > > try > { > // TODO AME externalize string >- monitor.subTask("Initializing Code Generation"); >+ monitor.subTask(Messages.CODE_GEN_STEP1); > _helper = _codeGenerationDelegate.run(new SubProgressMonitor( > monitor, 1)); >+ // Step 4 : Copy the axis2 files for CodeGeneration >+ if(_isAxis2Project){ >+ _helper.addAdditionalJars(_serverLocation, axis2files); >+ } > monitor.worked(1); > } > catch (Exception e) >@@ -120,7 +165,7 @@ > try > { > // TODO AME externalize string >- monitor.subTask("Merging WSDL"); >+ monitor.subTask(Messages.CODE_GEN_STEP2); > _mergedWsdlDocuments = _helper.getWsdlDocuments(_baseAddress); > monitor.worked(1); > } >@@ -132,14 +177,14 @@ > try > { > // TODO AME externalize string >- monitor.subTask("Creating project"); >+ monitor.subTask(Messages.CODE_GEN_STEP3); > runProjectizer(monitor); > monitor.worked(1); > } > catch (Exception e) > { > throw new InvocationTargetException(new Exception( >- "Code generation failed, see Error Log", e)); >+ Messages.CODE_GEN_FAILED_ERROR, e)); > } > } > finally >@@ -161,6 +206,10 @@ > _overwrite = _generationOptionsPage.isOverwrite(); > _projectName = _generationOptionsPage.getProjectName(); > _baseAddress = _generationOptionsPage.getBaseAddress(); >+ _isAxis2Project = _generationOptionsPage.isAxis2Project(); >+ >+ if(_isAxis2Project) >+ _serverLocation = _generationProjectPage.getServerLocation(); > > IRunnableWithProgress runnable = new IRunnableWithProgress() > { >@@ -180,7 +229,7 @@ > { > // TODO AME externalize string > e.printStackTrace(); >- handle("Code generation failed, see Error Log", e); >+ handle(Messages.CODE_GEN_FAILED_ERROR, e); > } > > return false; >@@ -235,21 +284,19 @@ > data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR, > new SubProgressMonitor(monitor, 1)); > // TODO AME externalize string >- monitor.subTask("Running Analyzer"); >+ monitor.subTask(Messages.CODE_GEN_SUBTASK1); > data = _analyzer.analyze(data); > monitor.worked(1); > >- data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR, >- new SubProgressMonitor(monitor, 1)); >+ data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR,new SubProgressMonitor(monitor, 1)); > // TODO AME externalize string >- monitor.subTask("Running Synthesizer"); >+ monitor.subTask(Messages.CODE_GEN_SUBTASK2); > data = _synthesizer.synthesize(data); > monitor.worked(1); > >- data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR, >- new SubProgressMonitor(monitor, 1)); >+ data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR,new SubProgressMonitor(monitor, 1)); > // TODO AME externalize string >- monitor.subTask("Running Projectizer"); >+ monitor.subTask(Messages.CODE_GEN_SUBTASK3); > _projectizer.projectize(data); > monitor.worked(1); > } >@@ -263,8 +310,7 @@ > private void handle(String message, Exception e) > { > _generationOptionsPage.setErrorMessage(message); >- Status status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, >- message, e); >+ Status status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, e); > > if (LOG == null) > { >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/MRTCodeGenerationDelegate.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/MRTCodeGenerationDelegate.java,v >retrieving revision 1.1 >diff -u -r1.1 MRTCodeGenerationDelegate.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/MRTCodeGenerationDelegate.java 1 Feb 2007 05:04:44 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/MRTCodeGenerationDelegate.java 5 Feb 2007 06:26:35 -0000 >@@ -69,14 +69,13 @@ > public DescriptorHelper run(SubProgressMonitor progressMonitor) > throws Exception > { >- File ddFile = createDDFile(); >+ IFile ddFile = createDDFile(); > return new DescriptorHelper(ddFile); > } > >- private File createDDFile() >+ private IFile createDDFile() > { > _ddFilePath = createDDFilePath(); >- > // > // Create a resource set > // >@@ -115,7 +114,8 @@ > > IFile file = EclipseUtils.getIFile(ResourcesPlugin.getWorkspace() > .getRoot(), fileURI.toString()); >- return file.getLocation().toFile(); >+ //return file.getLocation().toFile(); >+ return file; > } > catch (Exception exception) > { >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/GenerationOptionsPage.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/GenerationOptionsPage.java,v >retrieving revision 1.1 >diff -u -r1.1 GenerationOptionsPage.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/GenerationOptionsPage.java 1 Feb 2007 05:04:44 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/GenerationOptionsPage.java 5 Feb 2007 06:26:34 -0000 >@@ -110,6 +110,7 @@ > private Map _servicePorts; > private Map _servicePaths; > >+ private boolean axis2Project; > /** > * For cheatsheet purpose only This constructor will be used in cheatsheet > * only >@@ -184,11 +185,12 @@ > page.setLayoutData(gd); > > Label projectizerLabel = new Label(page, SWT.NONE); >- projectizerLabel.setText("Projectizer: "); >+ projectizerLabel.setText(Messages.CODE_GEN_PROJECTIZER); > _projectizerCombo = makeProjectizerCombo(page); > GridData data = new GridData(GridData.FILL_HORIZONTAL); > data.widthHint = 50; > _projectizerCombo.setLayoutData(data); >+ _projectizerCombo.addListener(SWT.Modify, comboChangeListener); > > Label blankLabel = new Label(page, SWT.NONE); > blankLabel.setText(" "); >@@ -519,8 +521,13 @@ > } > }; > >- void setLocationForSelection() >- { >+ private Listener comboChangeListener = new Listener() { >+ public void handleEvent(Event e) { >+ dialogChanged(); >+ } >+ }; >+ >+ void setLocationForSelection() { > // _locationArea.updateProjectName(getProjectNameFieldValue()); > } > >@@ -610,6 +617,7 @@ > updateStatus(Messages.HOOKUP_WIZARD_ERROR_2); > return; > } >+ canFlipToNextPage(); > > updateStatus(null, DialogPage.NONE); > } >@@ -625,8 +633,20 @@ > setPageComplete(type != DialogPage.ERROR); > } > >- private Button makeButton(Composite parent, String title, int style) >- { >+ public boolean canFlipToNextPage(){ >+ if(isPageComplete() && _projectizerCombo.getText().contains("Axis2")){ >+ axis2Project = true; >+ return true; >+ } >+ axis2Project = false; >+ return false; >+ } >+ >+ public boolean isAxis2Project(){ >+ return axis2Project; >+ } >+ >+ private Button makeButton(Composite parent, String title, int style) { > Button b = new Button(parent, style); > b.setText(title); > return b; >@@ -872,4 +892,5 @@ > text = ((IResource) element).getFullPath().toString(); > return text; > } >+ > } >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/DescriptorHelper.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/DescriptorHelper.java,v >retrieving revision 1.1 >diff -u -r1.1 DescriptorHelper.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/DescriptorHelper.java 1 Feb 2007 05:04:44 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/DescriptorHelper.java 5 Feb 2007 06:26:33 -0000 >@@ -13,16 +13,29 @@ > package org.eclipse.tptp.wsdm.tooling.codegen.mrt.internal; > > import java.io.File; >+import java.io.IOException; >+import java.util.Collections; > > import javax.xml.namespace.QName; > > import org.apache.muse.core.descriptor.DescriptorConstants; > import org.apache.muse.util.xml.XmlUtils; >+import org.apache.ws.muse.descriptor.AdditionalJarsType; >+import org.apache.ws.muse.descriptor.DescriptorPackage; >+import org.apache.ws.muse.descriptor.DocumentRoot; >+import org.apache.ws.muse.descriptor.RootType; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IWorkspace; > import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.IPath; >+import org.eclipse.emf.common.util.URI; >+import org.eclipse.emf.ecore.resource.Resource; >+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; >+import org.eclipse.tptp.wsdm.tooling.editor.dde.util.internal.DdeUtil; >+import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; >+import org.eclipse.tptp.wsdm.tooling.util.internal.MyDescriptorResourceFactoryImpl; >+import org.eclipse.tptp.wsdm.tooling.util.internal.WsdmToolingLog; > import org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal.NewMrtWizard; > import org.w3c.dom.Document; > import org.w3c.dom.Element; >@@ -88,6 +101,7 @@ > */ > private Object[][] _instances; > >+ private IFile ddIFile; > /** > * A do-something constructor. Take a file, if that file is null, then load > * up a default template. Otherwise load up the file and pull out the >@@ -104,12 +118,12 @@ > public DescriptorHelper(IFile descriptorFile) throws Exception > { > this(new File(descriptorFile.getLocation().toString())); >+ ddIFile = descriptorFile; > } > > public DescriptorHelper(File file) throws Exception > { > Document rootDocument = XmlUtils.createDocument(file); >- > _descriptorDocument = extractDescriptorDocument(rootDocument); > _instances = extractInstances(rootDocument); > _jarFiles = extractJarFiles(rootDocument); >@@ -340,4 +354,48 @@ > { > return fileName.substring(0, fileName.lastIndexOf(".")) + MRT_EXTN; > } >+ >+ public void addAdditionalJars(String serverLocation, String[] axis2files) { >+ >+ DocumentRoot root = DdeUtil.getDocRoot(ddIFile); >+ RootType rootType = root.getRoot(); >+ AdditionalJarsType additionalJars = rootType.getAdditionalJars(); >+ for(int i = 0 ; i < axis2files.length ; i++ ){ >+ additionalJars.getJarPath().add(serverLocation + File.separator + axis2files[i]); >+ } >+ >+ rootType.setAdditionalJars(additionalJars); >+ root.setRoot(rootType); >+ save(root); >+ } >+ >+ private void save(DocumentRoot root) >+ { >+ ensureMusePackagePresent(); >+ URI ddFileURI = URI.createPlatformResourceURI(ddIFile.getFullPath().toString()); >+ ResourceSetImpl rsImpl = new ResourceSetImpl(); >+ rsImpl.getResourceFactoryRegistry().getExtensionToFactoryMap() >+ .put(Resource.Factory.Registry.DEFAULT_EXTENSION, >+ new MyDescriptorResourceFactoryImpl()); >+ rsImpl.getPackageRegistry().put(DescriptorPackage.eNS_URI, >+ DescriptorPackage.eINSTANCE); >+ Resource ddRes = rsImpl.getResource(ddFileURI, true); >+ ddRes.getContents().remove(0); >+ ddRes.getContents().add(root); >+ try { >+ ddRes.save(Collections.EMPTY_MAP); >+ } catch (IOException e) { >+ e.printStackTrace(); >+ } >+ } >+ >+ private void ensureMusePackagePresent() >+ { >+ // Ensure EMF knows about Muse descriptor >+ if (DescriptorPackage.eINSTANCE == null) >+ { >+ WsdmToolingLog.logError(Messages.FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_, new Throwable()); >+ } >+ } >+ > } >Index: src/org/eclipse/tptp/wsdm/tooling/editor/mrt/internal/MrtPrototypeForm.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/editor/mrt/internal/MrtPrototypeForm.java,v >retrieving revision 1.1 >diff -u -r1.1 MrtPrototypeForm.java >--- src/org/eclipse/tptp/wsdm/tooling/editor/mrt/internal/MrtPrototypeForm.java 1 Feb 2007 05:04:34 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/editor/mrt/internal/MrtPrototypeForm.java 5 Feb 2007 06:26:37 -0000 >@@ -571,18 +571,9 @@ > { > public void handleEvent(Event event) > { >- System.out.println("Capability to delete : " >- + _selectedCapForDelete.getName()); > DeleteCapabilityCommand delete = new DeleteCapabilityCommand( > _editingDomain, _mrt, _selectedCapForDelete); > delete.execute(); >- // TODO >- // deleteDefinition(_selectedCapForDelete); >- // _allCaps.add(_selectedCapForDelete); >- // RemoveCommand rc = new RemoveCommand(_editingDomain, _mrt >- // .getImplements(), _selectedCapForDelete.getLocation()); >- // _editingDomain.getCommandStack().execute(rc); >- // _treeViewer.setInput(getAllNamespaces()); > _treeViewer.refresh(); > _treeViewer.expandAll(); > _expandAllButton.setEnabled(true); >@@ -621,45 +612,6 @@ > getForm().reflow(true); > } > >- /** >- * Dialog which brings up workspace capabilities as a JFace >- * CheckboxTableViewer. >- */ >- protected void selectCaps() >- { >- // Initialize workspace capabilities. >- // TODO >- // WorkspaceCapSelector dlg = new WorkspaceCapSelector(_mrtSection >- // .getShell(), Messages.ADD_CAP, MRT_CAPS, _containerName); >- // int choice = dlg.open(); >- // if (choice == Window.OK) { >- // List selectedCaps = dlg.getSelectedCaps(); >- // MRT_CAPS.addAll(selectedCaps); >- // _allCaps.removeAll(selectedCaps); >- // AddCommand ac = new AddCommand(_editingDomain, >- // _mrt.getImplements(), >- // convertDefinitionsToStrings(selectedCaps)); >- // _editingDomain.getCommandStack().execute(ac); >- // } >- } >- >- private void deleteDefinition() >- { >- // TODO >- // for (int i = 0; i < MRT_CAPS.size(); i++) { >- // Definition d = (Definition) MRT_CAPS.get(i); >- // if (d.getLocation().equals(def.getLocation())) { >- // if (MrtUtils.isMetadataExchangeCapability(def) >- // || MrtUtils.isWSRPCapability(def)) >- // showOkDialog(Messages.WARNING, NLS.bind( >- // Messages.MRT_MAY_NOT_WORK_WITH_MAX, WsdlUtils >- // .getName(def)), MessageDialog.INFORMATION); >- // MRT_CAPS.remove(d); >- // break; >- // } >- // } >- } >- > public void propertyChanged(Object source, int propId) > { > Resource res = (Resource) _editingDomain.getResourceSet() >@@ -677,12 +629,6 @@ > { > MrtCategoryCollection collection = new MrtCategoryCollection(_mrt); > Category[] categories = collection.getAllCategories(); >- /* >- * for(int i = 0 ; i < categories.length ; i++){ Capability[] caps = >- * categories[i].getCapabilities(); for(int j = 0 ; j < caps.length ; >- * j++){ System.out.println("Category : " + categories[i].getName() + " >- * capability : " + caps[j].getName()); } } >- */ > _treeViewer.setInput(Arrays.asList(categories)); > _treeViewer.refresh(); > >Index: src/org/eclipse/tptp/wsdm/tooling/editor/dde/util/internal/DdeUtil.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/editor/dde/util/internal/DdeUtil.java,v >retrieving revision 1.1 >diff -u -r1.1 DdeUtil.java >--- src/org/eclipse/tptp/wsdm/tooling/editor/dde/util/internal/DdeUtil.java 1 Feb 2007 05:04:42 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/editor/dde/util/internal/DdeUtil.java 5 Feb 2007 06:26:37 -0000 >@@ -17,8 +17,6 @@ > import java.util.Iterator; > import java.util.List; > >-import javax.wsdl.Definition; >- > import org.apache.ws.muse.descriptor.CapabilityType; > import org.apache.ws.muse.descriptor.CustomSerializerType; > import org.apache.ws.muse.descriptor.DescriptorFactory; >@@ -54,14 +52,16 @@ > import org.eclipse.swt.widgets.Table; > import org.eclipse.swt.widgets.TableItem; > import org.eclipse.swt.widgets.Text; >-import org.eclipse.tptp.wsdm.tooling.codegen.mrt.internal.Generation; > import org.eclipse.tptp.wsdm.tooling.editor.dde.internal.DescriptorEditor; >+import org.eclipse.tptp.wsdm.tooling.editor.internal.CapabilityDefinition; > import org.eclipse.tptp.wsdm.tooling.model.capabilities.Capability; > import org.eclipse.tptp.wsdm.tooling.model.capabilities.Property; > import org.eclipse.tptp.wsdm.tooling.model.manageableResourceType.ManageableResourceType; > import org.eclipse.tptp.wsdm.tooling.nls.messages.dde.internal.Messages; >+import org.eclipse.tptp.wsdm.tooling.util.internal.EclipseUtils; > import org.eclipse.tptp.wsdm.tooling.util.internal.MrtUtils; > import org.eclipse.tptp.wsdm.tooling.util.internal.MyDescriptorResourceFactoryImpl; >+import org.eclipse.tptp.wsdm.tooling.util.internal.WsdlUtils; > import org.eclipse.tptp.wsdm.tooling.util.internal.WsdmToolingLog; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkbenchPage; >@@ -74,7 +74,7 @@ > > /** > * This utility class contains some helper methods for DescriptorEditor. >- * >+ * > */ > public class DdeUtil > { >@@ -95,9 +95,11 @@ > IWorkbenchPage page = workbenchWindow.getActivePage(); > if (file.getFullPath().toString().startsWith("/plugin/")) //$NON-NLS-1$ > { >- MessageDialog.openInformation(page.getActiveEditor() >- .getEditorSite().getShell(), Messages.COMMON_ERROR_TITLE, //$NON-NLS-1$ >- Messages.DU_ERROR_MSG1); //$NON-NLS-1$ >+ MessageDialog >+ .openInformation( >+ page.getActiveEditor().getEditorSite().getShell(), >+ Messages.COMMON_ERROR_TITLE, //$NON-NLS-1$ >+ Messages.DU_ERROR_MSG1); //$NON-NLS-1$ > return; > } > try >@@ -105,12 +107,9 @@ > page.openEditor(new FileEditorInput(modelFile), workbench > .getEditorRegistry().getDefaultEditor(modelFile.getName()) > .getId()); >- } >- catch (Exception ex) >+ } catch (Exception ex) > { >- WsdmToolingLog.logError(NLS.bind( >- Messages.COULDNT_OPEN_DEFAULT_EDITOR_FOR_FILE_ERROR_, file >- .getName()), ex); >+ WsdmToolingLog.logError(NLS.bind(Messages.COULDNT_OPEN_DEFAULT_EDITOR_FOR_FILE_ERROR_, file.getName()),ex); > } > } > >@@ -133,10 +132,10 @@ > * > * @return List object containing the resources in the workspace. > */ >- public static List loadResources() // throws Exception >+ public static List loadResources() //throws Exception > { > List resourceList = new ArrayList(); >- >+ > IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() > .getProjects(); > if (projects != null && projects.length > 0) >@@ -148,12 +147,9 @@ > { > projectResources = projects[i].members(); > } >- catch (CoreException ex) >+ catch(CoreException ex) > { >- // WsdmToolingLog.logError(Messages.FAILED_TO_GET_MEMBERS_FOR_PROJECT_ERROR_ >- // , ex); this line is commented out because if any project >- // in the workspace is closed, this throws an error in the >- // problems view. >+ //WsdmToolingLog.logError(Messages.FAILED_TO_GET_MEMBERS_FOR_PROJECT_ERROR_ , ex); this line is commented out because if any project in the workspace is closed, this throws an error in the problems view. > continue; > } > if (projectResources == null || projectResources.length == 0) >@@ -162,7 +158,7 @@ > getFilesFromResource(projectResources[j], resourceList); > } > } >- >+ > return resourceList; > } > >@@ -176,15 +172,14 @@ > * @throws Exception > */ > public static void getFilesFromResource(IResource res, List resourceList) >- // throws Exception >+ //throws Exception > { > try > { > if (res.getType() == IResource.FILE) > { > resourceList.add(res); >- } >- else if (res.getType() == IResource.FOLDER) >+ } else if (res.getType() == IResource.FOLDER) > { > IResource[] files = ((IFolder) res).members(); > if (files == null || files.length == 0) >@@ -195,11 +190,9 @@ > } > } > } >- catch (CoreException ex) >+ catch(CoreException ex) > { >- WsdmToolingLog.logError(NLS.bind( >- Messages.FAILED_TO_GET_MEMBERS_FOR_RESOURCE_ERROR_, res >- .getName()), ex); >+ WsdmToolingLog.logError(NLS.bind(Messages.FAILED_TO_GET_MEMBERS_FOR_RESOURCE_ERROR_, res.getName()), ex); > } > } > >@@ -255,22 +248,18 @@ > .setJavaIdFactoryClass("org.apache.muse.core.routing.CounterResourceIdFactory"); //$NON-NLS-1$ > rtd > .setJavaResourceClass("org.apache.muse.ws.resource.impl.SimpleWsResource"); //$NON-NLS-1$ >- >- // Fix for defect 60319 >+ >+ //Fix for defect 60319 > rtd.setUseRouterPersistence(true); >- >+ > rtd.getCapability().addAll(getCapabilitiesFromMRT(mrt)); > WsdlType wsdlType = DescriptorFactory.eINSTANCE.createWsdlType(); > wsdlType.setWsdlFile(wsdlName); > > String namespace = mrt.getNamespace(); > String prefix = getOrCreatePrefix(root, namespace); >- String localPart = Messages.DU_PORT_TYPE_LOCAL_PART; // Only >- // "PortType" >- // should come >- // with the >- // //$NON-NLS-1$ >- wsdlType.setWsdlPortType(prefix + ":" + localPart); >+ String localPart = Messages.DU_PORT_TYPE_LOCAL_PART; // Only "PortType" should come with the //$NON-NLS-1$ >+ wsdlType.setWsdlPortType(prefix+":"+localPart); > > rtd.setWsdl(wsdlType); > >@@ -356,16 +345,28 @@ > */ > public static MuseType loadDecriptorFile(IFile file) > { >- URI uri = URI.createPlatformResourceURI(file.getFullPath().toString()); >- if (uri == null) >- return null; >- MuseType mt = loadMuseType(uri); >+ MuseType mt = loadMuseType(file); > return mt; > } > > // Return MuseType at URI. >- private static MuseType loadMuseType(URI uri) >+ private static MuseType loadMuseType(IFile file) >+ { >+ DocumentRoot root = getDocRoot(file); >+ RootType rt = root.getRoot(); >+ return rt.getMuse(); >+ } >+ >+ /** >+ * This method takes a dd file and returns the document root of the file >+ * @param file - IFile which is a dd file >+ * @return DocumentRoot of the file. >+ */ >+ public static DocumentRoot getDocRoot(IFile file) > { >+ URI uri = URI.createPlatformResourceURI(file.getFullPath().toString()); >+ if (uri == null) >+ return null; > ensureMusePackagePresent(); > ResourceSet resourceSet = new ResourceSetImpl(); > resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() >@@ -375,18 +376,15 @@ > DescriptorPackage.eINSTANCE); > Resource resource = resourceSet.getResource(uri, true); > DocumentRoot root = (DocumentRoot) resource.getContents().get(0); >- RootType rt = root.getRoot(); >- return rt.getMuse(); >+ return root; > } >- >+ > private static void ensureMusePackagePresent() > { > // Ensure EMF knows about Muse descriptor > if (DescriptorPackage.eINSTANCE == null) > { >- WsdmToolingLog.logError( >- Messages.FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_, >- new Throwable()); >+ WsdmToolingLog.logError(Messages.FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_, new Throwable()); > } > } > >@@ -404,45 +402,61 @@ > if (mrt == null) > return null; > List capDataList = new ArrayList(); >- Capability[] capabilities = new Capability[0]; >- try >- { >- capabilities = MrtUtils.getCapabilities(mrt); >- } >- catch (Exception e) >- { >- } >- for (int i = 0; i < capabilities.length; i++) >+ List caps = mrt.getImplements(); >+ if (caps != null) > { >- Definition definition = capabilities[i].getWsdlDefinition() >- .getDefinition(); >- String capNS = ""; >- if (definition != null) >+ for (int i = 0; i < caps.size(); i++) > { >- String nsURI = capabilities[i].getWsdlDefinition() >- .getNamespace("capabilityURI"); >- if (nsURI != null) >- capNS = nsURI; >- else >- capNS = definition.getTargetNamespace(); >+ CapabilityDefinition def; >+ try >+ { >+ IFile iFile = EclipseUtils.getIFile((String) caps.get(i)); >+ def = WsdlUtils.getCapabilityDefinition(iFile); >+ } catch (Exception e) >+ { >+ continue; >+ } >+ String capNS = ""; //$NON-NLS-1$ >+ if (def != null) >+ { >+ capNS = def.getNamespace("xmlns:capabilityURI"); >+ if(capNS == null) >+ capNS = def.getNamespace("targetNamespace"); >+ if(capNS == null) >+ capNS = ""; >+ } else >+ { >+ capNS = ""; >+ } >+ CapabilityTypeImpl ctype = (CapabilityTypeImpl) DescriptorFactory.eINSTANCE >+ .createCapabilityType(); >+ ctype.setCapabilityUri(capNS); >+ ctype.setJavaCapabilityClass(""); //$NON-NLS-1$ >+ /*boolean isValid = validateCapability(capDataList, ctype); >+ if (isValid)*/ >+ capDataList.add(ctype); > } >- CapabilityTypeImpl ctype = (CapabilityTypeImpl) DescriptorFactory.eINSTANCE >- .createCapabilityType(); >- ctype.setCapabilityUri(capNS); >- ctype.setJavaCapabilityClass(""); //$NON-NLS-1$ >- capDataList.add(ctype); > } > return capDataList; > } > >- /* >- * private static boolean validateCapability(List capDataList, >- * CapabilityTypeImpl ctype) { if (capDataList == null || capDataList.size() == >- * 0) { capDataList = new ArrayList(); return true; } for (int i = 0; i < >- * capDataList.size(); i++) { CapabilityTypeImpl tmp = (CapabilityTypeImpl) >- * capDataList.get(i); if (tmp.getCapabilityUri().trim().equals( >- * ctype.getCapabilityUri().trim())) return false; } return true; } >- */ >+ /*private static boolean validateCapability(List capDataList, >+ CapabilityTypeImpl ctype) >+ { >+ if (capDataList == null || capDataList.size() == 0) >+ { >+ capDataList = new ArrayList(); >+ return true; >+ } >+ for (int i = 0; i < capDataList.size(); i++) >+ { >+ CapabilityTypeImpl tmp = (CapabilityTypeImpl) capDataList.get(i); >+ if (tmp.getCapabilityUri().trim().equals( >+ ctype.getCapabilityUri().trim())) >+ return false; >+ } >+ return true; >+ }*/ > > private static String getDefaultWsdlFileName(String mrtFileName) > { >@@ -520,7 +534,8 @@ > | SWT.LEFT_TO_RIGHT); > txtIDFactory.setText(data.getJavaIdFactoryClass()); > txtIDFactory.setEnabled(false); >- txtIDFactory.setToolTipText(Messages.DU_TXT_ID_FACTORY_TOOLTIP); //$NON-NLS-1$ >+ txtIDFactory >+ .setToolTipText(Messages.DU_TXT_ID_FACTORY_TOOLTIP); //$NON-NLS-1$ > controlEditor.setEditor(txtIDFactory, ti, 4); > // controlEditor > // ti.setText(4, data.getJavaIdFactoryClass()); >@@ -545,6 +560,21 @@ > ti.setData(data); > } > >+ /*private static Capability getCapability(URI uri) >+ { >+ Definition def; >+ try >+ { >+ def = WsdlUtils.getWSDLDefinition(uri); >+ } catch (Exception e) >+ { >+ return null; >+ } >+ Definition2Capability def2Capability = new Definition2Capability(def); >+ Capability cap = def2Capability.getCapability(); >+ return cap; >+ }*/ >+ > /** > * Method that checks whether the given {@link InitParamTypeImpl} object is > * valid to be added to the initialization parameters table. >@@ -560,17 +590,17 @@ > * @return true if the parameter data is not a duplicate.<br> > * false otherwise > */ >- public static boolean validateParam(EObject data, InitParamTypeImpl pData, >- int idx) >+ public static boolean validateParam(EObject data, >+ InitParamTypeImpl pData, int idx) > { > if (data == null || pData == null) > return false; > List paramList = null; >- if (data instanceof ResourceTypeType) >+ if(data instanceof ResourceTypeType) > { > paramList = ((ResourceTypeType) data).getInitParam(); > } >- else if (data instanceof CapabilityTypeImpl) >+ else if(data instanceof CapabilityTypeImpl) > { > paramList = ((CapabilityTypeImpl) data).getInitParam(); > } >@@ -670,7 +700,8 @@ > { > IFile file = (IFile) availableFiles.get(i); > // here filename comes with full path.... >- if (file.getFullPath().toString().trim().equals(fileName.trim())) >+ if (file.getFullPath().toString().trim() >+ .equals(fileName.trim())) > return file; > } > return null; >@@ -751,12 +782,10 @@ > } > return false; > } >- >+ > /** > * Formats the given path string to return the display name of the file. >- * >- * @param jp - >- * file path >+ * @param jp - file path > * @return displayName - name of the file. > */ > public static String formatPath(String jp) >@@ -764,7 +793,7 @@ > jp = jp.trim(); > jp = jp.replace('\\', '/'); > int idx = jp.trim().lastIndexOf('/'); >- if (idx == -1) >+ if(idx == -1) > { > return jp; > } >@@ -775,14 +804,12 @@ > } > > /** >- * Create and return a new instance of given ResourceTypeType. Only >- * ContextPath, JavaIdFactoryClass, JavaResourceClass and WsdlType fields >- * have been copied. >+ * Create and return a new instance of given ResourceTypeType. >+ * Only ContextPath, JavaIdFactoryClass, JavaResourceClass and WsdlType fields have been copied. > */ > public static ResourceTypeType cloneResourceType(ResourceTypeType rt) > { >- ResourceTypeType clone = DescriptorFactory.eINSTANCE >- .createResourceTypeType(); >+ ResourceTypeType clone = DescriptorFactory.eINSTANCE.createResourceTypeType(); > clone.setContextPath(rt.getContextPath()); > clone.setJavaIdFactoryClass(rt.getJavaIdFactoryClass()); > clone.setJavaResourceClass(rt.getJavaResourceClass()); >@@ -792,144 +819,134 @@ > clone.setWsdl(wClone); > return clone; > } >- >+ > /** > * Returns the initial instances provided for given ResourceTypeType. > */ >- public static InitialInstancesType[] getInitialInstances(RootType root, >- ResourceTypeType resourceType) >+ public static InitialInstancesType[] getInitialInstances(RootType root, ResourceTypeType resourceType) > { >- List mrtInitInstances = new ArrayList(); >- List allInitInstances = root.getInitialInstances(); >- for (int i = 0; i < allInitInstances.size(); i++) >- { >- InitialInstancesType initInstance = (InitialInstancesType) allInitInstances >- .get(i); >- ResourceTypeType rt = initInstance.getResourceType(); >- if (rt.getContextPath().equals(resourceType.getContextPath()) >- && rt.getWsdl().getWsdlFile().equals( >- resourceType.getWsdl().getWsdlFile())) >- mrtInitInstances.add(initInstance); >- } >- return (InitialInstancesType[]) mrtInitInstances >- .toArray(new InitialInstancesType[mrtInitInstances.size()]); >- } >- >- /** >- * Checks whether the given mrt file is already added to the deployment >- * descriptor. >- * >- * @param mrtFileName - >- * name of the file >- * @param editor - >- * DescriptorEditor instance >+ List mrtInitInstances = new ArrayList(); >+ List allInitInstances = root.getInitialInstances(); >+ for(int i=0;i<allInitInstances.size();i++) >+ { >+ InitialInstancesType initInstance = (InitialInstancesType) allInitInstances.get(i); >+ ResourceTypeType rt = initInstance.getResourceType(); >+ if(rt.getContextPath().equals(resourceType.getContextPath()) >+ && rt.getWsdl().getWsdlFile().equals(resourceType.getWsdl().getWsdlFile())) >+ mrtInitInstances.add(initInstance); >+ } >+ return (InitialInstancesType[])mrtInitInstances.toArray(new InitialInstancesType[mrtInitInstances.size()]); >+ } >+ >+ /** >+ * Checks whether the given mrt file is already added to the deployment descriptor. >+ * @param mrtFileName - name of the file >+ * @param editor - DescriptorEditor instance > * @return true if already added, else false. > */ >- public static boolean presentInTheList(String mrtFileName, >- DescriptorEditor editor) >+ public static boolean presentInTheList(String mrtFileName, DescriptorEditor editor) > { >- if (mrtFileName == null || mrtFileName.trim().length() == 0) >+ if(mrtFileName == null || mrtFileName.trim().length() == 0) > { > return true; > } > org.eclipse.swt.widgets.List lst = editor.getLstAddedMrts(); > String items[] = lst.getItems(); >- if (items == null || items.length == 0) >+ if(items == null || items.length == 0) > { > return false; > } >- for (int i = 0; i < items.length; i++) >+ for(int i = 0; i < items.length; i++) > { >- if (items[i].equals(mrtFileName)) >+ if(items[i].equals(mrtFileName)) > { > return true; > } > } > return false; > } >- >+ > /** >- * Returns all the CustomSerializerType available in given >- * ManageableResourceType. >+ * Returns all the capabilities available in given ManageableResourceType. > */ >- public static CustomSerializerType[] getCustomSerializerType( >- ManageableResourceType mrt) throws IOException, CoreException >+ public static Capability[] getAllCapabilities(ManageableResourceType mrt) throws IOException, CoreException > { >- List serializerTypes = new ArrayList(); >- Capability[] capability = new Capability[0]; >- try >- { >- capability = MrtUtils.getCapabilities(mrt); >- } >- catch (Exception e) >- { >+ Capability[] caps = null; >+ try { >+ caps = MrtUtils.getCapabilities(mrt); >+ } catch (Exception e) { >+ WsdmToolingLog.logError( >+ org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages.MRT_ERROR_CANNOT_TRACE_CAPS, e); > } >- for (int capIndex = 0; capIndex < capability.length; capIndex++) >+ if(caps != null) >+ return caps; >+ return new Capability[0]; >+ } >+ >+ /** >+ * Returns all the CustomSerializerType available in given ManageableResourceType. >+ */ >+ public static CustomSerializerType[] getCustomSerializerType(ManageableResourceType mrt) throws IOException, CoreException >+ { >+ List serializerTypes = new ArrayList(); >+ Capability[] capability = getAllCapabilities(mrt); >+ for(int capIndex=0; capIndex<capability.length; capIndex++) >+ { >+ List props = capability[capIndex].getProperties(); >+ for(int propIndex=0; propIndex<props.size(); propIndex++) > { >- List props = capability[capIndex].getProperties(); >- for (int propIndex = 0; propIndex < props.size(); propIndex++) >- { >- Property property = (Property) props.get(propIndex); >- XSDElementDeclaration element = property.getElement(); >- if (element != null) >- { >- CustomSerializerType serializer = getCustomSerializerType(element); >- if (serializer != null) >- serializerTypes.add(serializer); >- } >- } >+ Property property = (Property) props.get(propIndex); >+ XSDElementDeclaration element = property.getElement(); >+ if(element != null) >+ { >+ CustomSerializerType serializer = getCustomSerializerType(element); >+ if(serializer != null) >+ serializerTypes.add(serializer); >+ } > } >- return (CustomSerializerType[]) serializerTypes >- .toArray(new CustomSerializerType[serializerTypes.size()]); >+ } >+ return (CustomSerializerType[]) serializerTypes.toArray(new CustomSerializerType[serializerTypes.size()]); > } >- >- private static CustomSerializerType getCustomSerializerType( >- XSDElementDeclaration elementDeclaration) >+ >+ private static CustomSerializerType getCustomSerializerType(XSDElementDeclaration elementDeclaration) > { >- XSDTypeDefinition typeDef = elementDeclaration.getTypeDefinition(); >- if (typeDef == null) >- return null; >- if (!(typeDef instanceof XSDComplexTypeDefinition)) >- return null; >- XSDComplexTypeDefinition complexTypeDef = (XSDComplexTypeDefinition) typeDef; >- CustomSerializerType serializer = DescriptorFactory.eINSTANCE >- .createCustomSerializerType(); >- String ns = complexTypeDef.getTargetNamespace(); >- String name = complexTypeDef.getName(); >- if (name == null) >- name = ""; >- serializer.setJavaSerializableType("{" + ns + "}" + name); >- serializer.setJavaSerializerClass(""); >- return serializer; >+ XSDTypeDefinition typeDef = elementDeclaration.getTypeDefinition(); >+ if(typeDef == null) >+ return null; >+ if(!(typeDef instanceof XSDComplexTypeDefinition)) >+ return null; >+ XSDComplexTypeDefinition complexTypeDef = (XSDComplexTypeDefinition) typeDef; >+ CustomSerializerType serializer = DescriptorFactory.eINSTANCE.createCustomSerializerType(); >+ String ns = complexTypeDef.getTargetNamespace(); >+ String name = complexTypeDef.getName(); >+ if(name == null) >+ name = ""; >+ serializer.setJavaSerializableType("{"+ns+"}"+name); >+ serializer.setJavaSerializerClass(""); >+ return serializer; > } >- >+ > /** > * Loads the CustomSerializerType obtained from given MRT to the MuseType. > */ >- public static void loadCustomSerializerTypeData(ManageableResourceType mrt, >- MuseType muse) throws IOException, CoreException >+ public static void loadCustomSerializerTypeData(ManageableResourceType mrt, MuseType muse) throws IOException, CoreException > { >- CustomSerializerType[] serializers = getCustomSerializerType(mrt); >- List ddSerializers = muse.getCustomSerializer(); >- for (int serializersIndex = 0; serializersIndex < serializers.length; serializersIndex++) >- { >+ CustomSerializerType[] serializers = getCustomSerializerType(mrt); >+ List ddSerializers = muse.getCustomSerializer(); >+ for(int serializersIndex=0; serializersIndex<serializers.length; serializersIndex++) >+ { > boolean found = false; >- for (int ddSerializersIndex = 0; ddSerializersIndex < ddSerializers >- .size(); ddSerializersIndex++) >- { >- CustomSerializerType ddSerializer = (CustomSerializerType) ddSerializers >- .get(ddSerializersIndex); >- if (ddSerializer.getJavaSerializableType() >- .equals( >- serializers[serializersIndex] >- .getJavaSerializableType())) >- { >+ for(int ddSerializersIndex=0; ddSerializersIndex<ddSerializers.size(); ddSerializersIndex++) >+ { >+ CustomSerializerType ddSerializer = (CustomSerializerType) ddSerializers.get(ddSerializersIndex); >+ if(ddSerializer.getJavaSerializableType().equals(serializers[serializersIndex].getJavaSerializableType())) >+ { > found = true; > break; >- } >+ } > } >- if (!found) >- muse.getCustomSerializer().add(serializers[serializersIndex]); >- } >+ if(!found) >+ muse.getCustomSerializer().add(serializers[serializersIndex]); >+ } > } > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/plugin.xml,v >retrieving revision 1.1 >diff -u -r1.1 plugin.xml >--- plugin.xml 1 Feb 2007 05:04:32 -0000 1.1 >+++ plugin.xml 5 Feb 2007 06:26:33 -0000 >@@ -155,6 +155,15 @@ > </extension> > > <extension >+ point="org.eclipse.ui.preferencePages"> >+ <page >+ class="org.eclipse.tptp.wsdm.tooling.codegen.mrt.internal.MRTPreferencePage" >+ id="org.eclipse.tptp.wsdm.tooling.codegen.mrt.internal.MRTPreferencePage" >+ name="MRT Preferences Page"> >+ MRT Preferences Page >+ </page> >+ </extension> >+ <extension > point="org.eclipse.ui.startup"> > <startup > class="org.eclipse.tptp.wsdm.tooling.editor.internal.StartupCapabilitiesCollector"></startup> >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/MRTPreferencePage.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/MRTPreferencePage.java >diff -N src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/MRTPreferencePage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/MRTPreferencePage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,122 @@ >+package org.eclipse.tptp.wsdm.tooling.codegen.mrt.internal; >+ >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.preference.PreferencePage; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.osgi.util.TextProcessor; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.DirectoryDialog; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.tptp.wsdm.tooling.editor.internal.Activator; >+import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.IWorkbenchPreferencePage; >+ >+/** >+ * The class is used to create the Preference page for the MRT Editor. >+ * It is used to set Axis2 Server Location. >+ * >+ */ >+public class MRTPreferencePage extends PreferencePage implements >+ IWorkbenchPreferencePage { >+ >+ private Text _serverLocation; >+ >+ private Button _browseButton; >+ >+ /** >+ * >+ */ >+ public MRTPreferencePage() { >+ // TODO Auto-generated constructor stub >+ } >+ >+ /** >+ * >+ * @param title >+ */ >+ public MRTPreferencePage(String title) { >+ super(title); >+ // TODO Auto-generated constructor stub >+ } >+ >+ public MRTPreferencePage(String title, ImageDescriptor image) { >+ super(title, image); >+ // TODO Auto-generated constructor stub >+ } >+ >+ @Override >+ protected Control createContents(Composite parent) { >+ Composite composite = new Composite(parent, SWT.NONE); >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 2; >+ composite.setLayout(layout); >+ >+ GridData data = new GridData(); >+ data.horizontalSpan = 2; >+ data.grabExcessHorizontalSpace = true; >+ Label label = new Label(composite, SWT.NONE); >+ label.setLayoutData(data); >+ label.setText("Axis2 Server Location"); >+ >+ IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >+ String ss = store.getString("MRT_CODE_GEN.AXIS2_SERVER_LOCATION"); >+ data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); >+ //data.horizontalAlignment = SWT.FILL; >+ data.grabExcessHorizontalSpace = true; >+ data.horizontalSpan = 1; >+ data.widthHint = 240; >+ >+ _serverLocation = new Text(composite, SWT.BORDER); >+ _serverLocation.setLayoutData(data); >+ >+ //_combo.setItems(WSDMRuntimeFactory.getConreteRuntimes()); >+ String runtime = ""; >+ if (runtime != null || runtime.length() > 0) { >+ _serverLocation.setText(ss); >+ } else { >+ //if (_combo.getItemCount() > 0) { >+ _serverLocation.setText(""); >+ //} >+ } >+ >+ _browseButton = new Button(composite, SWT.PUSH); >+ _browseButton.setText(Messages.HOOKUP_WIZARD_TXT5); >+ _browseButton.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent event) { >+ handleLocationBrowseButtonPressed(); >+ } >+ }); >+ return composite; >+ } >+ >+ public void init(IWorkbench workbench) { >+ // TODO Auto-generated method stub >+ } >+ private void handleLocationBrowseButtonPressed() { >+ String selectedDirectory = null; >+ DirectoryDialog dialog = new DirectoryDialog(_serverLocation.getShell()); >+ dialog.setMessage(Messages.CODE_GEN_DIR_LOCATION); >+ selectedDirectory = dialog.open(); >+ >+ if (selectedDirectory != null) >+ _serverLocation.setText(TextProcessor.process(selectedDirectory)); >+ >+ } >+ /* @Override >+ protected void performDefaults() { >+ super.performDefaults(); >+ IPreferenceStore store = Activator.getDefault().getPreferenceStore(); >+// store.setValue("MRT_CODE_GEN.AXIS2_SERVER_LOCATION",""); >+ } >+*/ >+ >+} >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/GenerationProjectPage.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/GenerationProjectPage.java >diff -N src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/GenerationProjectPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/internal/GenerationProjectPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,148 @@ >+/** >+ * >+ */ >+package org.eclipse.tptp.wsdm.tooling.codegen.mrt.internal; >+ >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.osgi.util.TextProcessor; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.DirectoryDialog; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+ >+import org.eclipse.tptp.wsdm.tooling.editor.internal.Activator; >+import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; >+ >+/** >+ * This is Wizard Page to show the Axis2 server location details >+ * >+ */ >+public class GenerationProjectPage extends WizardPage{ >+ >+ private Text _serverNameField; >+ private Button _browseButton; >+ private Button _preferenceUpdate; >+ >+ /** >+ * Instantiates the class. >+ */ >+ public GenerationProjectPage() { >+ super("wizardPage"); >+ setTitle(Messages.HOOKUP_WIZARD_TXT1); >+ setDescription(Messages.HOOKUP_WIZARD_TXT2); >+ } >+ >+ public void createControl(Composite parent) { >+ Composite page = new Composite(parent, SWT.NULL); >+ GridLayout layout = new GridLayout(1, false); >+ page.setLayout(layout); >+ createPageControls(page); >+// dialogChanged(); >+ setControl(page); >+ } >+ >+ private void createPageControls(Composite page) { >+ Composite column = new Composite(page, SWT.NULL); >+ GridLayout layout = new GridLayout(2, false); >+ column.setLayout(layout); >+ >+ createServerLocationColumn(column); >+ >+ } >+ >+ private void createServerLocationColumn(Composite parent) { >+ GridData data = new GridData(GridData.FILL_HORIZONTAL); >+ data.horizontalSpan = 2; >+ // new server location label >+ Label serverLabel = new Label(parent, SWT.NONE); >+ serverLabel.setText(Messages.CODE_GEN_AXIS2_LOCATION); >+ serverLabel.setFont(parent.getFont()); >+ serverLabel.setLayoutData(data); >+ >+ // server location entry field >+ data = new GridData(GridData.FILL_HORIZONTAL); >+ data.widthHint = 350; >+ data.horizontalSpan = 1; >+ _serverNameField = new Text(parent, SWT.BORDER); >+ _serverNameField.setText(getPreferenceServerLocation()); >+ _serverNameField.setLayoutData(data); >+ _serverNameField.setFont(parent.getFont()); >+ >+ // browse button >+ _browseButton = new Button(parent, SWT.PUSH); >+ _browseButton.setText(Messages.HOOKUP_WIZARD_TXT5); >+ _browseButton.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent event) { >+ handleLocationBrowseButtonPressed(); >+ } >+ }); >+ >+ // server location entry field >+ data = new GridData(GridData.FILL_HORIZONTAL); >+ //data.widthHint = 350; >+ data.horizontalSpan = 2; >+ _preferenceUpdate = new Button(parent, SWT.CHECK); >+ _preferenceUpdate.setText(Messages.CODE_GEN_UPDATE_PREF); >+ _preferenceUpdate.setLayoutData(data); >+ _preferenceUpdate.setFont(parent.getFont()); >+ >+ _preferenceUpdate.addSelectionListener(new SelectionAdapter(){ >+ public void widgetSelected(SelectionEvent event){ >+ if(_preferenceUpdate.getSelection()){ >+ IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >+ store.setValue("MRT_CODE_GEN.AXIS2_SERVER_LOCATION",_serverNameField.getText()); >+ }else{ >+ // Do nothing, just leave the preference >+ } >+ }}); >+ >+ } >+ >+ private String getPreferenceServerLocation() { >+ IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >+ String location = store.getString("MRT_CODE_GEN.AXIS2_SERVER_LOCATION").trim(); >+ if(location != null && !location.equals("")) >+ return location; >+ return ""; >+ } >+ >+ private void handleLocationBrowseButtonPressed() { >+ >+ String selectedDirectory = null; >+ >+ DirectoryDialog dialog = new DirectoryDialog(_serverNameField.getShell()); >+ dialog.setMessage(Messages.CODE_GEN_DIR_LOCATION); >+ //dialog.setFilterPath(dirName); >+ selectedDirectory = dialog.open(); >+ >+ if (selectedDirectory != null) >+ updateLocationField(selectedDirectory); >+ >+ } >+ private void updateLocationField(String selectedPath) { >+ _serverNameField.setText(TextProcessor.process(selectedPath)); >+ } >+ >+ /** >+ * Returns the server location. >+ * @return >+ */ >+ public String getServerLocation() { >+ return _serverNameField.getText(); >+ } >+ >+ private boolean validateLocation(){ >+ >+ return false; >+ } >+ >+ >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 150385
: 58634 |
59357
|
59359
|
59361
|
59450
|
59461
|
59789
|
63686