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 59357 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]
Patch for Code Generation to use Axis2.
patch_150385_Axis2CodeGenWizard.txt (text/plain), 29.41 KB, created by
Nalini V
on 2007-02-20 05:22:02 EST
(
hide
)
Description:
Patch for Code Generation to use Axis2.
Filename:
MIME Type:
Creator:
Nalini V
Created:
2007-02-20 05:22:02 EST
Size:
29.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.wsdm.editor >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTCodeGenerationDelegate.java >=================================================================== >RCS file: /cvsroot/ganges/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTCodeGenerationDelegate.java,v >retrieving revision 1.1 >diff -u -r1.1 MRTCodeGenerationDelegate.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTCodeGenerationDelegate.java 19 Feb 2007 19:39:12 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTCodeGenerationDelegate.java 20 Feb 2007 10:16:43 -0000 >@@ -87,11 +87,13 @@ > public DescriptorHelper run(SubProgressMonitor progressMonitor) > throws Exception > { >- File ddFile = createDDFile(); >+ //File ddFile = createDDFile(); >+ IFile ddFile = createDDFile(); > return new DescriptorHelper(ddFile); > } > >- private File createDDFile() >+// private File createDDFile() >+ private IFile createDDFile() > { > _ddFilePath = createDDFilePath(); > >@@ -133,7 +135,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/provisional/GenerationOptionsPage.java >=================================================================== >RCS file: /cvsroot/ganges/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationOptionsPage.java,v >retrieving revision 1.1 >diff -u -r1.1 GenerationOptionsPage.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationOptionsPage.java 19 Feb 2007 19:39:12 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationOptionsPage.java 20 Feb 2007 10:16:43 -0000 >@@ -110,6 +110,8 @@ > private Map _servicePorts; > private Map _servicePaths; > >+ private boolean axis2Project; >+ > /** > * For cheatsheet purpose only This constructor will be used in cheatsheet > * only >@@ -184,11 +186,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(" "); >@@ -517,6 +520,12 @@ > } > }; > >+ private Listener comboChangeListener = new Listener() { >+ public void handleEvent(Event e) { >+ dialogChanged(); >+ } >+ }; >+ > void setLocationForSelection() > { > // _locationArea.updateProjectName(getProjectNameFieldValue()); >@@ -608,7 +617,9 @@ > updateStatus(Messages.HOOKUP_WIZARD_ERROR_2); > return; > } >- >+ >+ canFlipToNextPage(); >+ > updateStatus(null, DialogPage.NONE); > } > >@@ -738,6 +749,28 @@ > } > return baseAddress; > } >+ >+ /** >+ * Checks to see if the Next Page can be enabled or not. >+ */ >+ public boolean canFlipToNextPage(){ >+ if(isPageComplete() && _projectizerCombo.getText().contains("Axis2")){ >+ axis2Project = true; >+ ((GenerationProjectPage)this.getNextPage()).makePageComplete(false); >+ return true; >+ } >+ ((GenerationProjectPage)this.getNextPage()).makePageComplete(true); >+ axis2Project = false; >+ return false; >+ } >+ >+ /** >+ * Returns whether the new Project to be created is a Axis2 project >+ * @return >+ */ >+ public boolean isAxis2Project(){ >+ return axis2Project; >+ } > } > > // Not used currently >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/DescriptorHelper.java >=================================================================== >RCS file: /cvsroot/ganges/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/DescriptorHelper.java,v >retrieving revision 1.1 >diff -u -r1.1 DescriptorHelper.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/DescriptorHelper.java 19 Feb 2007 19:39:12 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/DescriptorHelper.java 20 Feb 2007 10:16:42 -0000 >@@ -13,16 +13,28 @@ > package org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional; > > 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; >@@ -87,6 +99,8 @@ > * useless "Pair" class. > */ > private Object[][] _instances; >+ >+ private IFile ddIFile; > > /** > * A do-something constructor. Take a file, if that file is null, then load >@@ -101,6 +115,7 @@ > public DescriptorHelper(IFile descriptorFile) throws Exception > { > this(new File(descriptorFile.getLocation().toString())); >+ ddIFile = descriptorFile; > } > > /** >@@ -357,4 +372,46 @@ > { > 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/codegen/mrt/provisional/NewProjectWizard.java >=================================================================== >RCS file: /cvsroot/ganges/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/NewProjectWizard.java,v >retrieving revision 1.1 >diff -u -r1.1 NewProjectWizard.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/NewProjectWizard.java 19 Feb 2007 19:39:12 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/NewProjectWizard.java 20 Feb 2007 10:16:43 -0000 >@@ -30,10 +30,12 @@ > import org.eclipse.core.runtime.SubProgressMonitor; > import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; > import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.wizard.Wizard; > import org.eclipse.swt.graphics.Image; >+import org.eclipse.tptp.wsdm.tooling.editor.internal.Activator; > import org.eclipse.tptp.wsdm.tooling.editor.mrt.internal.ManageableResourceTypeEditorPlugin; > import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; > import org.eclipse.tptp.wsdm.tooling.util.internal.EclipseUtils; >@@ -55,6 +57,7 @@ > > private GenerationOptionsPage _generationOptionsPage; > >+ private GenerationProjectPage _generationProjectPage; > private String _projectName; > > private boolean _overwrite; >@@ -73,6 +76,17 @@ > > private DescriptorHelper _helper; > >+ private String _serverLocation; >+ >+ private boolean _isAxis2Project; >+ private boolean updatePreference; >+ >+ java.net.URI _projectLocation; >+ >+ /** >+ * Class that creates the Code Generation Wizard to create new Project >+ * @param codeGenerationDelegate >+ */ > public NewProjectWizard(CodeGenerationDelegate codeGenerationDelegate) > { > setWindowTitle(Messages.HOOKUP_WIZARD_TXT7); >@@ -85,6 +99,9 @@ > { > _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 +116,31 @@ > { > try > { >- monitor.beginTask("Working: ", 6); >- >+ monitor.beginTask(Messages.CODE_GEN_START, 6); >+ >+ if(_isAxis2Project){ >+ try{ >+ // Step 1: Validate the server path >+ monitor.subTask(Messages.CODE_GEN_VALIDATE_SLOCATION); >+ // Step 2 : Update the Preferences, if needed >+ if(updatePreference){ >+ IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >+ store.setValue("MRT_CODE_GEN.AXIS2_SERVER_LOCATION",_serverLocation); >+ } >+ }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 3 : Copy the axis2 files for CodeGeneration >+ String[] axis2files = _generationProjectPage.getAxis2Files(); >+ if(_isAxis2Project){ >+ _helper.addAdditionalJars(_serverLocation, axis2files); >+ } > monitor.worked(1); > } > catch (Exception e) >@@ -119,8 +153,7 @@ > > try > { >- // TODO AME externalize string >- monitor.subTask("Merging WSDL"); >+ monitor.subTask(Messages.CODE_GEN_STEP2); > _mergedWsdlDocuments = _helper.getWsdlDocuments(_baseAddress); > monitor.worked(1); > } >@@ -131,15 +164,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,7 +193,14 @@ > _overwrite = _generationOptionsPage.isOverwrite(); > _projectName = _generationOptionsPage.getProjectName(); > _baseAddress = _generationOptionsPage.getBaseAddress(); >- >+ _isAxis2Project = _generationOptionsPage.isAxis2Project(); >+ >+ _projectLocation = _generationOptionsPage.getProjectLocationURI(); >+ >+ if(_isAxis2Project){ >+ _serverLocation = _generationProjectPage.getServerLocation(); >+ updatePreference = _generationProjectPage.isUpdatePreference(); >+ } > IRunnableWithProgress runnable = new IRunnableWithProgress() > { > public void run(IProgressMonitor monitor) >@@ -178,14 +217,14 @@ > } > catch (Exception e) > { >- // TODO AME externalize string > e.printStackTrace(); >- handle("Code generation failed, see Error Log", e); >+ handle(Messages.CODE_GEN_FAILED_ERROR, e); > } > > return false; > } > >+ > /* > * (non-Javadoc) > * >@@ -234,22 +273,22 @@ > > 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)); >- // 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)); >- // TODO AME externalize string >- monitor.subTask("Running Projectizer"); >+ >+ monitor.subTask(Messages.CODE_GEN_SUBTASK3); > _projectizer.projectize(data); > monitor.worked(1); > } >@@ -272,4 +311,5 @@ > } > LOG.log(status); > } >+ > } >Index: src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/Messages.java >=================================================================== >RCS file: /cvsroot/ganges/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/Messages.java,v >retrieving revision 1.2 >diff -u -r1.2 Messages.java >--- src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/Messages.java 9 Feb 2007 12:49:13 -0000 1.2 >+++ src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/Messages.java 20 Feb 2007 10:16:43 -0000 >@@ -125,8 +125,25 @@ > public static String CODE_GEN_DIR_LOCATION; > public static String MRT_CODE_GEN; > public static String MRT_CODE_GEN_TEXT; >- >- >+ 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; >+ public static String CODEGEN_PREF_SERVERLOC; >+ public static String CODE_GEN_AXIS2_PROJECT_DIR; >+ public static String CODE_GEN_AXIS2_LOCATION_ERROR; >+ public static String CODE_GEN_AXIS2_INSTAL_LOC_ERROR; >+ > static > { > NLS.initializeMessages(BUNDLE_NAME, Messages.class); >Index: src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties >=================================================================== >RCS file: /cvsroot/ganges/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties,v >retrieving revision 1.2 >diff -u -r1.2 messages.properties >--- src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties 9 Feb 2007 12:49:13 -0000 1.2 >+++ src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties 20 Feb 2007 10:16:43 -0000 >@@ -120,5 +120,21 @@ > CODE_GEN_DIR_LOCATION = Select the location directory. > MRT_CODE_GEN = Code Generation > MRT_CODE_GEN_TEXT = You can generate code after the creation of the MRT >- >- >+CODE_GEN_AXIS2_LOCATION = Axis2 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 >+CODEGEN_PREF_SERVERLOC = Axis2 Server Loaction >+CODE_GEN_AXIS2_PROJECT_DIR = Axis2 Server directory must be specified >+CODE_GEN_AXIS2_LOCATION_ERROR = Invalid Axis2 Server location path >+CODE_GEN_AXIS2_INSTAL_LOC_ERROR = Invalid Axis2 Server Installation Path >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTPreferencePage.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTPreferencePage.java >diff -N src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTPreferencePage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTPreferencePage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,139 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ *******************************************************************************/ >+ >+package org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional; >+ >+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 >+ init(); >+ } >+ >+ /** >+ * >+ * @param title >+ */ >+ public MRTPreferencePage(String title) { >+ super(title); >+ // TODO Auto-generated constructor stub >+ init(); >+ } >+ >+ public MRTPreferencePage(String title, ImageDescriptor image) { >+ super(title, image); >+ // TODO Auto-generated constructor stub >+ init(); >+ } >+ >+ 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); >+ String labelText = "Axis2 Server Loaction";//Messages.CODEGEN_PREF_SERVERLOC; >+ label.setText(labelText); >+ >+ IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >+ String ss = store.getString("MRT_CODE_GEN.AXIS2_SERVER_LOCATION"); >+ data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); >+ data.grabExcessHorizontalSpace = true; >+ data.horizontalSpan = 1; >+ data.widthHint = 240; >+ >+ _serverLocation = new Text(composite, SWT.BORDER); >+ _serverLocation.setLayoutData(data); >+ >+ String runtime = ""; >+ if (runtime != null || runtime.length() > 0) { >+ _serverLocation.setText(ss); >+ } else { >+ _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)); >+ >+ } >+ >+ protected void performDefaults() { >+ super.performDefaults(); >+ IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >+ String defaultValue = store.getDefaultString("MRT_CODE_GEN.AXIS2_SERVER_LOCATION"); >+ _serverLocation.setText(defaultValue); >+ } >+ >+ protected void performApply(){ >+ IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >+ store.setValue("MRT_CODE_GEN.AXIS2_SERVER_LOCATION",_serverLocation.getText()); >+ } >+ >+ private void init(){ >+ IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >+ store.setDefault("MRT_CODE_GEN.AXIS2_SERVER_LOCATION",""); >+ } >+} >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationProjectPage.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationProjectPage.java >diff -N src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationProjectPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationProjectPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,220 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional; >+ >+import java.io.File; >+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.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+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; >+ private final 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"}; >+ >+ /** >+ * Instantiates the class. >+ */ >+ public GenerationProjectPage() { >+ super("wizardPage"); >+ setTitle(Messages.HOOKUP_WIZARD_TXT1); >+ setDescription(Messages.HOOKUP_WIZARD_TXT2); >+ } >+ >+ /** >+ * Creates wizard controls. >+ */ >+ 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.setLayoutData(data); >+ _serverNameField.setFont(parent.getFont()); >+ _serverNameField.addModifyListener(new ModifyListener() >+ { >+ public void modifyText(ModifyEvent e) >+ { >+ boolean pageCompleted = true; >+ String errorMsg = validateLocation(); >+ if(errorMsg == null){ >+ setErrorMessage(errorMsg); >+ pageCompleted = true; >+ }else{ >+ setErrorMessage(errorMsg); >+ pageCompleted = false; >+ } >+ makePageComplete(pageCompleted); >+ >+ } >+ }); >+ >+ _serverNameField.setText(getPreferenceServerLocation()); >+ >+ // 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()); >+ } >+ >+ 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(); >+ } >+ >+ /** >+ * Checks to see if Update Preferences checkbox is selected >+ * @return >+ */ >+ public boolean isUpdatePreference(){ >+ return _preferenceUpdate.getSelection(); >+ } >+ >+ private String validateLocation(){ >+ String locationFieldContents = _serverNameField.getText(); >+ if (locationFieldContents.length() == 0) >+ { >+ return(Messages.CODE_GEN_AXIS2_PROJECT_DIR); >+ } >+ >+ java.io.File newPath = new java.io.File(_serverNameField.getText()); >+ if (!newPath.exists()) >+ { >+ return(Messages.CODE_GEN_AXIS2_LOCATION_ERROR); >+ } >+ >+ if(newPath.exists()){ >+ // Step 2 : Check for Axis2 installation libraries >+ boolean found = true; >+ >+ for(int i = 0 ; i < axis2files.length ; i++){ >+ File axisFile = new File(locationFieldContents+ File.separator+axis2files[i]); >+ if(axisFile.exists()) >+ continue; >+ else{ >+ found = false; >+ break; >+ } >+ } >+ if(!found){ >+ return Messages.CODE_GEN_AXIS2_INSTAL_LOC_ERROR; >+ } >+ } >+ return null; >+ } >+ >+ /** >+ * Returns the Axis2 files >+ * @return >+ */ >+ public String[] getAxis2Files(){ >+ return axis2files; >+ } >+ >+ /** >+ * Method to Set the Wizard page to complete state >+ * @param validPage >+ */ >+ public void makePageComplete(boolean completePage){ >+ if(completePage){ >+ setPageComplete(true); >+ }else{ >+ setPageComplete(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