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 117134 Details for
Bug 253635
[ds tooling] Service Component wizard improvements
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.
DSFileWizardPage and DSNewWizard updates
org.eclipse.pde.ds.ui.172.patch (text/plain), 13.07 KB, created by
Rafael Oliveira Nóbrega
on 2008-11-05 14:58:30 EST
(
hide
)
Description:
DSFileWizardPage and DSNewWizard updates
Filename:
MIME Type:
Creator:
Rafael Oliveira Nóbrega
Created:
2008-11-05 14:58:30 EST
Size:
13.07 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ds.ui >Index: src/org/eclipse/pde/internal/ds/ui/wizards/DSNewWizard.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/wizards/DSNewWizard.java,v >retrieving revision 1.6 >diff -u -r1.6 DSNewWizard.java >--- src/org/eclipse/pde/internal/ds/ui/wizards/DSNewWizard.java 3 Sep 2008 23:30:37 -0000 1.6 >+++ src/org/eclipse/pde/internal/ds/ui/wizards/DSNewWizard.java 5 Nov 2008 19:56:16 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.wizard.Wizard; > import org.eclipse.pde.internal.ds.ui.Activator; >+import org.eclipse.pde.internal.ds.ui.Messages; > import org.eclipse.ui.INewWizard; > import org.eclipse.ui.IWorkbench; > >@@ -38,6 +39,7 @@ > } > > public void init(IWorkbench workbench, IStructuredSelection currentSelection) { >+ setWindowTitle(Messages.DSNewWizard_title); > fMainPage = new DSFileWizardPage(currentSelection); > } > >Index: src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java,v >retrieving revision 1.8 >diff -u -r1.8 DSFileWizardPage.java >--- src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java 25 Sep 2008 02:37:45 -0000 1.8 >+++ src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java 5 Nov 2008 19:56:16 -0000 >@@ -13,20 +13,30 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.ds.ui.wizards; > >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; >+import org.eclipse.jdt.core.IJavaElement; >+import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jdt.core.search.SearchEngine; >+import org.eclipse.jdt.internal.core.JavaElement; >+import org.eclipse.jdt.internal.ui.packageview.ClassPathContainer; > import org.eclipse.jdt.ui.IJavaElementSearchConstants; > import org.eclipse.jdt.ui.JavaUI; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.window.Window; >+import org.eclipse.jface.wizard.WizardDialog; >+import org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel; >+import org.eclipse.pde.internal.core.natures.PDE; > import org.eclipse.pde.internal.ds.ui.Activator; > import org.eclipse.pde.internal.ds.ui.Messages; >+import org.eclipse.pde.internal.ds.ui.SWTUtil; >+import org.eclipse.pde.internal.ui.util.PDEModelUtility; > import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.FocusEvent; >-import org.eclipse.swt.events.FocusListener; > import org.eclipse.swt.events.ModifyEvent; > import org.eclipse.swt.events.ModifyListener; > import org.eclipse.swt.events.MouseEvent; >@@ -35,12 +45,18 @@ > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Group; > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.PartInitException; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.dialogs.SelectionDialog; > import org.eclipse.ui.dialogs.WizardNewFileCreationPage; >+import org.eclipse.ui.forms.events.HyperlinkEvent; >+import org.eclipse.ui.forms.events.IHyperlinkListener; >+import org.eclipse.ui.forms.widgets.Hyperlink; >+import org.osgi.framework.Constants; > > public class DSFileWizardPage extends WizardNewFileCreationPage { > >@@ -48,17 +64,22 @@ > > private static final String F_FILE_EXTENSION = "xml"; //$NON-NLS-1$ > >+ private static final String F_COMPONENT_NAME = "component.xml"; //$NON-NLS-1$ >+ > private Group fGroup; > > private Text fDSComponentNameText; > private Label fDSComponentNameLabel; > > private Text fDSImplementationClassText; >- private Label fDSImplementationClassLabel; >+ private Hyperlink fDSImplementationClassHyperlink; > private Button fDSImplementationClassButton; > >+ private IStructuredSelection fSelection; >+ > public DSFileWizardPage(IStructuredSelection selection) { > super(F_PAGE_NAME, selection); >+ this.fSelection = selection; > initialize(); > } > >@@ -72,9 +93,47 @@ > setDescription(Messages.DSFileWizardPage_description); > // Force the file extension to be 'xml' > setFileExtension(F_FILE_EXTENSION); >+ setFileName(F_COMPONENT_NAME); >+ } >+ >+ private void setComponentName() { >+ Object element = fSelection.getFirstElement(); >+ if (element != null) { >+ IProject project = getProject(element); >+ if (project != null) >+ setComponentNameText(project); >+ } >+ } >+ >+ private IProject getProject(Object element) { >+ IProject project = null; >+ if (element instanceof IResource) { >+ project = ((IResource) element).getProject(); >+ } else if (element instanceof JavaElement) { >+ project = ((JavaElement) element).getJavaProject().getProject(); >+ } else if (element instanceof ClassPathContainer) { >+ project = ((ClassPathContainer) element).getJavaProject() >+ .getProject(); >+ } >+ return project; >+ } >+ >+ private void setComponentNameText(IProject project) { >+ try { >+ if (project.hasNature(PDE.PLUGIN_NATURE)) { >+ WorkspaceBundlePluginModel model = new WorkspaceBundlePluginModel( >+ project.getFile(PDEModelUtility.F_MANIFEST_FP), null); >+ model.load(); >+ String header = model.getBundleModel().getBundle().getHeader( >+ Constants.BUNDLE_SYMBOLICNAME); >+ fDSComponentNameText.setText(header); >+ } >+ } catch (CoreException e) { >+ } > } > > protected void createAdvancedControls(Composite parent) { >+ > // Controls Group > fGroup = new Group(parent, SWT.NONE); > fGroup.setText(Messages.DSFileWizardPage_group); >@@ -91,42 +150,84 @@ > fDSComponentNameText = new Text(fGroup, SWT.SINGLE | SWT.BORDER); > fDSComponentNameText.setLayoutData(nameTextGridData); > fDSComponentNameText.setText(""); //$NON-NLS-1$ >- fDSComponentNameText.addFocusListener(new FocusListener() { >- public void focusGained(FocusEvent e) { >- if (!fDSComponentNameText.getText().equals("")) { //$NON-NLS-1$ >- return; >- } >- String text = DSFileWizardPage.this.getFileName(); >- if (text != null && text != "") { //$NON-NLS-1$ >- int index = text.lastIndexOf("."); //$NON-NLS-1$ >- if (index > 0) { >- fDSComponentNameText.setText(text.substring(0, index)); >- } else { >- fDSComponentNameText.setText(text); >- } >- } >- } >- >- public void focusLost(FocusEvent e) { >- } >- }); >- > fDSComponentNameText.addModifyListener(new ModifyListener() { > public void modifyText(ModifyEvent e) { > setPageComplete(checkPageComplete()); > } > }); >- >+ setComponentName(); > >- // Implementation Class Label >- fDSImplementationClassLabel = new Label(fGroup, >- SWT.NONE); >- fDSImplementationClassLabel >+ fDSImplementationClassHyperlink = new Hyperlink(fGroup, SWT.NONE); >+ fDSImplementationClassHyperlink > .setText(Messages.DSFileWizardPage_implementation_class); >+ fDSImplementationClassHyperlink.setUnderlined(true); >+ fDSImplementationClassHyperlink.setForeground(Display.getDefault() >+ .getSystemColor(SWT.COLOR_BLUE)); >+ fDSImplementationClassHyperlink >+ .addHyperlinkListener(new IHyperlinkListener() { >+ >+ public void linkActivated(HyperlinkEvent e) { >+ String value = fDSImplementationClassText.getText(); >+ value = handleLinkActivated(value, false); >+ if (value != null) >+ fDSImplementationClassText.setText(value); >+ >+ } >+ >+ private String handleLinkActivated(String value, >+ boolean isInter) { >+ Object object = fSelection.getFirstElement(); >+ if (object != null) { >+ IProject project = getProject(object); >+ try { >+ if (project != null >+ && project >+ .hasNature(JavaCore.NATURE_ID)) { >+ IJavaProject javaProject = JavaCore >+ .create(project); >+ IJavaElement element = javaProject >+ .findType(value.replace('$', '.')); >+ if (element != null) >+ JavaUI.openInEditor(element); >+ else { >+ // TODO create our own wizard for reuse >+ // here >+ DSNewClassCreationWizard wizard = new DSNewClassCreationWizard( >+ project, isInter, value); >+ WizardDialog dialog = new WizardDialog( >+ Activator >+ .getActiveWorkbenchShell(), >+ wizard); >+ dialog.create(); >+ SWTUtil.setDialogSize(dialog, 400, 500); >+ if (dialog.open() == Window.OK) { >+ return wizard.getQualifiedName(); >+ } >+ } >+ } >+ } catch (PartInitException e1) { >+ } catch (CoreException e1) { >+ } >+ } >+ return null; >+ } >+ >+ public void linkEntered(HyperlinkEvent e) { >+ fDSImplementationClassHyperlink.setForeground(Display >+ .getDefault().getSystemColor( >+ SWT.COLOR_DARK_BLUE)); >+ } >+ >+ public void linkExited(HyperlinkEvent e) { >+ fDSImplementationClassHyperlink.setForeground(Display >+ .getDefault().getSystemColor(SWT.COLOR_BLUE)); >+ >+ } >+ >+ }); > > // Implementation Class Text >- fDSImplementationClassText = new Text(fGroup, >- SWT.SINGLE | SWT.BORDER); >+ fDSImplementationClassText = new Text(fGroup, SWT.SINGLE | SWT.BORDER); > GridData classTextGridData = new GridData(GridData.FILL_HORIZONTAL); > classTextGridData.horizontalSpan = 1; > classTextGridData.horizontalIndent = 3; >@@ -139,19 +240,16 @@ > }); > > // Implementation Class Browse Button >- fDSImplementationClassButton = new Button(fGroup, >- SWT.NONE); >+ fDSImplementationClassButton = new Button(fGroup, SWT.NONE); > fDSImplementationClassButton.setText(Messages.DSFileWizardPage_browse); > fDSImplementationClassButton.addMouseListener(new MouseListener() { > > public void mouseDoubleClick(MouseEvent e) { > // TODO Auto-generated method stub >- > } > > public void mouseDown(MouseEvent e) { > // TODO Auto-generated method stub >- > } > > public void mouseUp(MouseEvent e) { >@@ -176,8 +274,8 @@ > } catch (CoreException e) { > } > } >- > }); >+ > } > > public String getDSComponentNameValue() { >@@ -189,20 +287,22 @@ > } > > private boolean checkPageComplete() { >+ if (fDSComponentNameText == null || fDSImplementationClassText == null) { >+ return false; >+ } > return fDSComponentNameText.getText().length() > 0 > && fDSImplementationClassText.getText().length() > 0; > } >- >+ > /* > * (non-Javadoc) > * >- * @see >- * org.eclipse.ui.dialogs.WizardNewFileCreationPage#validateLinkedResource() >+ * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validateLinkedResource() > */ > protected IStatus validateLinkedResource() { > return new Status(IStatus.OK, Activator.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$ > } >- >+ > protected void createLinkTarget() { > // NO-OP > } >@@ -211,6 +311,4 @@ > return checkPageComplete(); > } > >- >- > } >Index: src/org/eclipse/pde/internal/ds/ui/Messages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/Messages.java,v >retrieving revision 1.24 >diff -u -r1.24 Messages.java >--- src/org/eclipse/pde/internal/ds/ui/Messages.java 3 Nov 2008 21:37:09 -0000 1.24 >+++ src/org/eclipse/pde/internal/ds/ui/Messages.java 5 Nov 2008 19:56:15 -0000 >@@ -41,6 +41,8 @@ > public static String DSFileWizardPage_selectType; > public static String DSFileWizardPage_not_OSGI_folder; > >+ public static String DSNewWizard_title; >+ > public static String DSImplementationDetails_title; > public static String DSImplementationDetails_description; > public static String DSImplementationDetails_classEntry; >@@ -162,6 +164,7 @@ > public static String DSServiceComponentSection_enabledButtonMessage; > > public static String DSService_title; >+ > > > >Index: src/org/eclipse/pde/internal/ds/ui/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/messages.properties,v >retrieving revision 1.37 >diff -u -r1.37 messages.properties >--- src/org/eclipse/pde/internal/ds/ui/messages.properties 3 Nov 2008 21:37:09 -0000 1.37 >+++ src/org/eclipse/pde/internal/ds/ui/messages.properties 5 Nov 2008 19:56:15 -0000 >@@ -35,6 +35,8 @@ > DSFileWizardPage_selectType= Select Type > DSFileWizardPage_not_OSGI_folder=By convention, component files should be located in OSGI-INF/ folder > >+DSNewWizard_title=Component Definition >+ > DSImplementationDetails_title=Definition > DSImplementationDetails_description=Specify the service's implementation class: > DSImplementationDetails_classEntry=Class*:
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 Raw
Flags:
caniszczyk
:
iplog+
Actions:
View
Attachments on
bug 253635
: 117134 |
117506