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 120039 Details for
Bug 256731
[ds tooling] New Component wizard should create OSGI-INF folder and always place component definitions in that folder
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
org.eclipse.pde.ds.ui.186.patch (text/plain), 45.22 KB, created by
Rafael Oliveira Nóbrega
on 2008-12-10 08:45:51 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rafael Oliveira Nóbrega
Created:
2008-12-10 08:45:51 EST
Size:
45.22 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/pde/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/wizards/DSNewWizard.java,v >retrieving revision 1.8 >diff -u -r1.8 DSNewWizard.java >--- src/org/eclipse/pde/internal/ds/ui/wizards/DSNewWizard.java 8 Dec 2008 17:15:29 -0000 1.8 >+++ src/org/eclipse/pde/internal/ds/ui/wizards/DSNewWizard.java 10 Dec 2008 13:44:29 -0000 >@@ -14,16 +14,38 @@ > > import java.lang.reflect.InvocationTargetException; > >+import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.jdt.core.ICompilationUnit; >+import org.eclipse.jdt.core.IJavaElement; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.IMethod; >+import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jdt.core.JavaModelException; >+import org.eclipse.jdt.internal.core.JavaElement; >+import org.eclipse.jdt.internal.ui.packageview.ClassPathContainer; >+import org.eclipse.jdt.ui.JavaUI; > import org.eclipse.jface.dialogs.IDialogSettings; > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.StructuredSelection; > 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.pde.internal.ds.ui.parts.HandyPromptDialog; >+import org.eclipse.pde.internal.ui.PDEPlugin; >+import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.INewWizard; > import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.PartInitException; > > public class DSNewWizard extends Wizard implements INewWizard { >+ private static final String F_createOSGIFolder_key = "create_folder"; //$NON-NLS-1$ >+ private static final String F_OSGI_FOLDER_NAME = "OSGI-INF"; //$NON-NLS-1$ > protected DSFileWizardPage fMainPage; > > public DSNewWizard() { >@@ -33,32 +55,121 @@ > /* > * (non-Javadoc) > * >- * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#addPages() >+ * @see >+ * org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#addPages() > */ > public void addPages() { >- addPage(fMainPage); >+ addPage(fMainPage); > } >- >+ > public void init(IWorkbench workbench, IStructuredSelection currentSelection) { > setWindowTitle(Messages.DSNewWizard_title); >- setDialogSettings(Activator.getDefault().getDialogSettings()); >+ setDialogSettings(PDEPlugin.getDefault().getDialogSettings()); >+ currentSelection = getOSGIFolderSelection(currentSelection); > fMainPage = new DSFileWizardPage(currentSelection); > } > >+ private IStructuredSelection getOSGIFolderSelection( >+ IStructuredSelection currentSelection) { >+ if (currentSelection != null) { >+ Object element = currentSelection.getFirstElement(); >+ if (element != null) { >+ IProject project = getProject(element); >+ if (project != null) { >+ IResource findMember = project >+ .findMember(F_OSGI_FOLDER_NAME); >+ if (findMember != null) { >+ if (findMember instanceof IFolder) { >+ currentSelection = new StructuredSelection( >+ findMember); >+ } >+ } else { >+ currentSelection = getNewFolderPath(currentSelection, >+ project); >+ } >+ } >+ } >+ >+ } >+ return currentSelection; >+ } >+ >+ private IStructuredSelection getNewFolderPath( >+ IStructuredSelection currentSelection, IProject project) { >+ if (this.getDialogSettings().get(F_createOSGIFolder_key) == null) { >+ // show dialog >+ HandyPromptDialog dialog = new HandyPromptDialog(this.getShell(), >+ Messages.DSNewWizard_createOSGIFolder_message); >+ dialog.setCancelButtonText(null); >+ dialog.setTitle(Messages.DSNewWizard_createOSGIFolder_title); >+ int checkboxId = dialog.addCheckbox( >+ Messages.DSNewWizard_RememberMyDecision, false); >+ dialog.open(); >+ >+ // return osgiFolder selection if yes button was selected >+ boolean value = dialog.getReturnCode() == HandyPromptDialog.YES_ID; >+ if (value) { >+ IFolder folder = project.getFolder(F_OSGI_FOLDER_NAME); >+ try { >+ folder.create(false, true, new NullProgressMonitor()); >+ currentSelection = new StructuredSelection(folder); >+ } catch (CoreException e) { >+ } >+ } >+ // save user option selection if checkbox was selected >+ if (dialog.isCheckboxSelected(checkboxId)) { >+ this.getDialogSettings().put(F_createOSGIFolder_key, value); >+ } >+ } else { >+ if (this.getDialogSettings().getBoolean(F_createOSGIFolder_key)) { >+ IFolder folder = project.getFolder(F_OSGI_FOLDER_NAME); >+ try { >+ folder.create(false, true, new NullProgressMonitor()); >+ currentSelection = new StructuredSelection(folder); >+ } catch (CoreException e) { >+ } >+ } >+ } >+ return currentSelection; >+ } >+ >+ 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; >+ } >+ > /* > * (non-Javadoc) > * >- * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#performFinish() >+ * @see >+ * org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#performFinish >+ * () > */ > public boolean performFinish() { > try { >+ >+ String implementationClassValue = fMainPage >+ .getDSImplementationClassValue(); >+ if (fMainPage.isGenerateMethodsButtonSelected()) { >+ IMethod firstMethod = createMethods(implementationClassValue); >+ openInJavaEditor(firstMethod); >+ } >+ > IDialogSettings settings = getDialogSettings(); > if (settings != null) { > fMainPage.saveSettings(settings); > } > IRunnableWithProgress op = new DSCreationOperation(fMainPage > .createNewFile(), fMainPage.getDSComponentNameValue(), >- fMainPage.getDSImplementationClassValue()); >+ implementationClassValue); > > getContainer().run(false, true, op); > } catch (InvocationTargetException e) { >@@ -66,7 +177,49 @@ > return false; > } catch (InterruptedException e) { > return false; >+ } catch (JavaModelException e) { >+ return false; >+ } catch (PartInitException e) { >+ return false; > } > return true; > } >+ >+ private void openInJavaEditor(IMethod firstMethod) >+ throws JavaModelException, PartInitException { >+ if (firstMethod != null) { >+ IEditorPart javaEditor; >+ javaEditor = JavaUI.openInEditor(firstMethod.getCompilationUnit()); >+ JavaUI.revealInEditor(javaEditor, (IJavaElement) firstMethod); >+ } >+ } >+ >+ private IMethod createMethods(String implementationClassValue) >+ throws JavaModelException { >+ >+ IJavaProject proj = JavaCore.create(fMainPage.getProject()); >+ IType saved_type = proj.findType(implementationClassValue); >+ ICompilationUnit workingCU = saved_type.getCompilationUnit() >+ .getWorkingCopy(new NullProgressMonitor()); >+ >+ // create import >+ String importString = "org.osgi.service.component.ComponentContext";//$NON-NLS-1$ >+ workingCU.createImport(importString, null, new NullProgressMonitor()); >+ >+ // create methods >+ IType workingType = workingCU.getType(saved_type.getElementName()); >+ String activateMethodString = "protected void activate(ComponentContext context) {\n" //$NON-NLS-1$ >+ + " // TODO Auto-generated method stub \n}";//$NON-NLS-1$ >+ String deactivateMethodString = "protected void deactivate(ComponentContext context) {\n" //$NON-NLS-1$ >+ + " // TODO Auto-generated method stub \n}";//$NON-NLS-1$ >+ IMethod first_method = workingType.createMethod(activateMethodString, >+ null, false, new NullProgressMonitor()); >+ workingType.createMethod(deactivateMethodString, null, false, >+ new NullProgressMonitor()); >+ >+ workingCU.commitWorkingCopy(false, new NullProgressMonitor()); >+ return first_method; >+ >+ } >+ > } >Index: src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java,v >retrieving revision 1.12 >diff -u -r1.12 DSFileWizardPage.java >--- src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java 8 Dec 2008 17:20:11 -0000 1.12 >+++ src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java 10 Dec 2008 13:44:28 -0000 >@@ -15,12 +15,12 @@ > > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.ResourcesPlugin; > 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.IMethod; > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jdt.core.search.SearchEngine; >@@ -37,6 +37,7 @@ > 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.PDEPlugin; > import org.eclipse.pde.internal.ui.util.PDEModelUtility; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.ModifyEvent; >@@ -68,7 +69,9 @@ > > private static final String F_DEFAULT_COMPONENT_NAME = "component.xml"; //$NON-NLS-1$ > >- private static final String S_COMPONENT_NAME = "component"; //$NON-NLS-1$ >+ private static final String F_COMPONENT_NAME = "component"; //$NON-NLS-1$ >+ >+ private static final String F_GENERATE_METHODS = "generate_methods"; //$NON-NLS-1$ > > private Group fGroup; > >@@ -79,8 +82,12 @@ > private Hyperlink fDSImplementationClassHyperlink; > private Button fDSImplementationClassButton; > >+ private Button fGenerateMethodsButton; >+ > private IStructuredSelection fSelection; > >+ private IProject project; >+ > public DSFileWizardPage(IStructuredSelection selection) { > super(F_PAGE_NAME, selection); > this.fSelection = selection; >@@ -90,7 +97,9 @@ > /* > * (non-Javadoc) > * >- * @see org.eclipse.pde.internal.ui.wizards.cheatsheet.CheatSheetFileWizardPage#initialize() >+ * @see >+ * org.eclipse.pde.internal.ui.wizards.cheatsheet.CheatSheetFileWizardPage >+ * #initialize() > */ > protected void initialize() { > setTitle(Messages.DSFileWizardPage_title); >@@ -100,11 +109,13 @@ > } > > private void setComponentName() { >- Object element = fSelection.getFirstElement(); >- if (element != null) { >- IProject project = getProject(element); >- if (project != null) >- setComponentNameText(project); >+ if (fSelection != null) { >+ Object element = fSelection.getFirstElement(); >+ if (element != null) { >+ IProject project = getProject(element); >+ if (project != null) >+ setComponentNameText(project); >+ } > } > } > >@@ -118,6 +129,11 @@ > project = ((ClassPathContainer) element).getJavaProject() > .getProject(); > } >+ this.project = project; >+ return project; >+ } >+ >+ public IProject getProject() { > return project; > } > >@@ -139,8 +155,8 @@ > protected void createAdvancedControls(Composite parent) { > IDialogSettings settings = getDialogSettings(); > if (settings != null) { >- String component = settings.get(S_COMPONENT_NAME); >- if (component != null && !component.equals("")) { //$NON-NLS-1$ >+ String component = settings.get(F_COMPONENT_NAME); >+ if (component != null && !component.equals("")) { > setFileName(component); > } else { > setFileName(F_DEFAULT_COMPONENT_NAME); >@@ -170,7 +186,6 @@ > setPageComplete(isPageComplete()); > } > }); >- setComponentName(); > > fDSImplementationClassHyperlink = new Hyperlink(fGroup, SWT.NONE); > fDSImplementationClassHyperlink >@@ -181,15 +196,15 @@ > fDSImplementationClassHyperlink > .addHyperlinkListener(new IHyperlinkListener() { > >- public void linkActivated(HyperlinkEvent e) { >+ public void linkActivated(HyperlinkEvent e) { > String value = fDSImplementationClassText.getText(); > value = handleLinkActivated(value, false); > if (value != null) > fDSImplementationClassText.setText(value); > >- } >+ } > >- private String handleLinkActivated(String value, >+ private String handleLinkActivated(String value, > boolean isInter) { > Object object = fSelection.getFirstElement(); > if (object != null) { >@@ -217,29 +232,29 @@ > 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) { >+ public void linkEntered(HyperlinkEvent e) { > fDSImplementationClassHyperlink.setForeground(Display > .getDefault().getSystemColor( > SWT.COLOR_DARK_BLUE)); > } > >- public void linkExited(HyperlinkEvent e) { >+ public void linkExited(HyperlinkEvent e) { > fDSImplementationClassHyperlink.setForeground(Display > .getDefault().getSystemColor(SWT.COLOR_BLUE)); > >- } >+ } > >- }); >+ }); > > // Implementation Class Text > fDSImplementationClassText = new Text(fGroup, SWT.SINGLE | SWT.BORDER); >@@ -290,6 +305,13 @@ > } > } > }); >+ >+ fGenerateMethodsButton = new Button(fGroup, SWT.CHECK); >+ fGenerateMethodsButton.setText(Messages.DSFileWizardPage_createMethods); >+ fGenerateMethodsButton.setEnabled(false); >+ fGenerateMethodsButton.setSelection(false); >+ >+ setComponentName(); > validatePage(); > } > >@@ -324,16 +346,22 @@ > } > > public boolean isPageComplete() { >+ updateCreateMethodsButton(); > return checkPageComplete() & validatePage(); > } > > public void saveSettings(IDialogSettings settings) { >- settings.put(S_COMPONENT_NAME, getFileName()); >+ settings.put(F_COMPONENT_NAME, getFileName()); >+ if (fGenerateMethodsButton.isEnabled()) { >+ settings.put(F_GENERATE_METHODS, fGenerateMethodsButton >+ .getSelection()); >+ } >+ > } > > protected boolean validatePage() { > if (fDSImplementationClassText != null) { >- IStatus status = ResourcesPlugin.getWorkspace().validateName( >+ IStatus status = PDEPlugin.getWorkspace().validateName( > fDSImplementationClassText.getText(), IResource.FILE); > if (!status.isOK()) { > setErrorMessage(status.getMessage()); >@@ -343,4 +371,48 @@ > return super.validatePage(); > } > >+ private void updateCreateMethodsButton() { >+ boolean wasDisabled = !fGenerateMethodsButton.isEnabled(); >+ try { >+ IType type = JavaCore.create(this.getProject()).findType( >+ this.getDSImplementationClassValue()); >+ if (type != null) { >+ IMethod methodActivate = type.getMethod("activate", //$NON-NLS-1$ >+ new String[] { "QComponentContext;" }); //$NON-NLS-1$ >+ IMethod methodDeactivate = type.getMethod("deactivate", //$NON-NLS-1$ >+ new String[] { "QComponentContext;" }); //$NON-NLS-1$ >+ if (type.findMethods(methodActivate) == null >+ && type.findMethods(methodDeactivate) == null) { >+ if (wasDisabled) { >+ enableAndToggleGenerateButton(); >+ } >+ return; >+ } >+ } >+ } catch (Exception e) { >+ } >+ fGenerateMethodsButton.setEnabled(false); >+ fGenerateMethodsButton.setSelection(false); >+ >+ } >+ >+ private void enableAndToggleGenerateButton() { >+ fGenerateMethodsButton.setEnabled(true); >+ IDialogSettings settings = getDialogSettings(); >+ if (settings != null) { >+ if (settings.get(F_GENERATE_METHODS) != null) { >+ fGenerateMethodsButton.setSelection(settings >+ .getBoolean(F_GENERATE_METHODS)); >+ >+ } else { >+ fGenerateMethodsButton.setSelection(true); >+ } >+ } else { >+ fGenerateMethodsButton.setSelection(true); >+ } >+ } >+ >+ public boolean isGenerateMethodsButtonSelected() { >+ return fGenerateMethodsButton.getSelection(); >+ } > } >Index: src/org/eclipse/pde/internal/ds/ui/Messages.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/Messages.java,v >retrieving revision 1.25 >diff -u -r1.25 Messages.java >--- src/org/eclipse/pde/internal/ds/ui/Messages.java 11 Nov 2008 21:14:42 -0000 1.25 >+++ src/org/eclipse/pde/internal/ds/ui/Messages.java 10 Dec 2008 13:44:27 -0000 >@@ -40,8 +40,14 @@ > public static String DSFileWizardPage_browse; > public static String DSFileWizardPage_selectType; > public static String DSFileWizardPage_not_OSGI_folder; >+ public static String DSFileWizardPage_createMethods; > > public static String DSNewWizard_title; >+ public static String DSNewWizard_createOSGIFolder_title; >+ public static String DSNewWizard_createOSGIFolder_message; >+ public static String DSNewWizard_defaultOSGIFolder_title; >+ public static String DSNewWizard_defaultOSGIFolder_message; >+ public static String DSNewWizard_RememberMyDecision; > > public static String DSImplementationDetails_title; > public static String DSImplementationDetails_description; >@@ -165,6 +171,8 @@ > > public static String DSService_title; > >+ public static String HandyPromptDialog_Prompt; >+ public static String HandyPromptDialog_UnknownButtonId; > > > >Index: src/org/eclipse/pde/internal/ds/ui/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/pde/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/messages.properties,v >retrieving revision 1.39 >diff -u -r1.39 messages.properties >--- src/org/eclipse/pde/internal/ds/ui/messages.properties 8 Dec 2008 02:17:09 -0000 1.39 >+++ src/org/eclipse/pde/internal/ds/ui/messages.properties 10 Dec 2008 13:44:28 -0000 >@@ -34,8 +34,14 @@ > DSFileWizardPage_browse=Bro&wse... > DSFileWizardPage_selectType= Select Type > DSFileWizardPage_not_OSGI_folder=By convention, component files should be located in OSGI-INF/ folder >+DSFileWizardPage_createMethods=Generate &lifecycle methods > > DSNewWizard_title=New Component Definition >+DSNewWizard_createOSGIFolder_title=Create OSGI-INF Folder >+DSNewWizard_createOSGIFolder_message=Do you want to create the OSGI-INF folder? (recommended) >+DSNewWizard_defaultOSGIFolder_title=OSGI-INF Folder >+DSNewWizard_defaultOSGIFolder_message=Make OSGI-INF as default folder? (recommended) >+DSNewWizard_RememberMyDecision=Remember my decision > > DSImplementationDetails_title=Definition > DSImplementationDetails_description=Specify the service's implementation class: >@@ -155,4 +161,7 @@ > > DSServiceComponentSection_immediateButtonMessage=This component is immediately activated > DSServiceComponentSection_enabledButtonMessage=This component is enabled when started >-DSService_title=Services >\ No newline at end of file >+DSService_title=Services >+ >+HandyPromptDialog_Prompt=Prompt >+HandyPromptDialog_UnknownButtonId=Unknown button id {0} >\ No newline at end of file >Index: src/org/eclipse/pde/internal/ds/ui/parts/IHandyDialog.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ds/ui/parts/IHandyDialog.java >diff -N src/org/eclipse/pde/internal/ds/ui/parts/IHandyDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ds/ui/parts/IHandyDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,43 @@ >+/******************************************************************************* >+ * Copyright (c) 2001, 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ds.ui.parts; >+ >+import org.eclipse.jface.dialogs.IDialogConstants; >+ >+public interface IHandyDialog { >+ // Values returned by open() >+ public static final int CANCEL_ID = IDialogConstants.CANCEL_ID; >+ public static final int NO_ID = IDialogConstants.NO_ID; >+ public static final int OK_ID = IDialogConstants.OK_ID; >+ public static final int YES_ID = IDialogConstants.YES_ID; >+ >+ /** >+ * @see org.eclipse.jface.window.Window.open() >+ */ >+ public int open(); >+ >+ /** >+ * Set the size of the dialog. This is only a hint, since dialogs must >+ * respect the dialog font size. The most you can expect is that the >+ * dialog will be no smaller than the width and height specified. >+ * >+ * @param width The width of the dialog. >+ * @param height The height of the dialog. >+ */ >+ public void setSize(int width, int height); >+ >+ /** >+ * Set the title of the dialog. >+ * >+ * @param title The title of the dialog. >+ */ >+ public void setTitle(String title); >+} >Index: src/org/eclipse/pde/internal/ds/ui/parts/IHandyPromptDialog.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ds/ui/parts/IHandyPromptDialog.java >diff -N src/org/eclipse/pde/internal/ds/ui/parts/IHandyPromptDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ds/ui/parts/IHandyPromptDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2001, 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ds.ui.parts; >+ >+import org.eclipse.swt.graphics.Image; >+ >+public interface IHandyPromptDialog extends IHandyDialog { >+ public int addCheckbox(String text, boolean selected); >+ public int addRadioButton(String text, boolean selected); >+ public void defaultButtonIsCancel(); >+ public void defaultButtonIsNo(); >+ public void defaultButtonIsYes(); >+ public int getSelectedRadioButtonId(); >+ public boolean isCheckboxSelected(int id); >+ public void removeAllCheckboxes(); >+ public void removeAllRadioButtons(); >+ public void setCancelButtonText(String cancelButtonText); >+ public void setCheckboxGroupText(String checkboxGroupText); >+ public void setCheckboxSelected(int id, boolean selected); >+ public void setImage(Image image); >+ public void setNoButtonText(String negativeButtonLabel); >+ public void setRadioButtonGroupText(String radioButtonGroupText); >+ public void setRadioButtonSelected(int id, boolean selected); >+ public void setYesButtonText(String positiveButtonLabel); >+ public void useErrorIcon(); >+ public void useInformationIcon(); >+ public void useQuestionIcon(); >+ public void useWarningIcon(); >+} >\ No newline at end of file >Index: src/org/eclipse/pde/internal/ds/ui/parts/HandyDialog.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ds/ui/parts/HandyDialog.java >diff -N src/org/eclipse/pde/internal/ds/ui/parts/HandyDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ds/ui/parts/HandyDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,120 @@ >+/******************************************************************************* >+ * Copyright (c) 2001, 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ds.ui.parts; >+ >+import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.graphics.Point; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; >+ >+abstract class HandyDialog extends Dialog implements IHandyDialog { >+ private String title; >+ private Point size; >+ >+ protected HandyDialog(Shell parentShell) { >+ super(parentShell); >+ } >+ >+ /** >+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) >+ */ >+ protected void configureShell(Shell shell) { >+ super.configureShell(shell); >+ configureShellTitle(shell); >+ } >+ >+ private void configureShellTitle(Shell shell) { >+ String title = getTitle(); >+ if (title == null) >+ return; // Early return. >+ shell.setText(title); >+ } >+ >+ protected abstract void createArea(Composite composite); >+ >+ /** >+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) >+ */ >+ protected final Control createDialogArea(Composite parent) { >+ Composite composite = (Composite) super.createDialogArea(parent); >+ createArea(composite); >+ postCreateArea(composite); >+ Dialog.applyDialogFont(composite); >+ return composite; >+ } >+ >+ private Display getDisplay() { >+ Shell shell = getShell(); >+ Display display = shell != null ? shell.getDisplay() : Display.getDefault(); >+ return display; >+ } >+ >+ /** >+ * @see org.eclipse.jface.window.Window#getInitialSize() >+ */ >+ protected Point getInitialSize() { >+ Point initialSize = super.getInitialSize(); >+ Point result = initialSize; >+ Point size = getSize(); >+ >+ if (size != null) { >+ if (size.x >= initialSize.x) { >+ result.x = size.x; >+ } >+ >+ if (size.y >= initialSize.y) { >+ result.y = size.y; >+ } >+ } >+ >+ return result; >+ } >+ >+ private Point getSize() { >+ return size; >+ } >+ >+ protected final Image getSystemImage(int id) { >+ Display display = getDisplay(); >+ Image image = display.getSystemImage(id); >+ return image; >+ } >+ >+ private String getTitle() { >+ return title; >+ } >+ >+ protected void postCreateArea(Composite composite) { >+ // No-op >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyDialog#setSize(int, int) >+ */ >+ public void setSize(int width, int height) { >+ Point point = new Point(width, height); >+ setSize(point); >+ } >+ >+ private void setSize(Point size) { >+ this.size = size; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#setTitle(java.lang.String) >+ */ >+ public void setTitle(String title) { >+ this.title = title; >+ } >+} >Index: src/org/eclipse/pde/internal/ds/ui/parts/HandyPromptDialog.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ds/ui/parts/HandyPromptDialog.java >diff -N src/org/eclipse/pde/internal/ds/ui/parts/HandyPromptDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ds/ui/parts/HandyPromptDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,599 @@ >+/******************************************************************************* >+ * Copyright (c) 2001, 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ds.ui.parts; >+ >+import java.text.MessageFormat; >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+ >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.pde.internal.ds.ui.Messages; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.layout.RowLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; >+ >+/** >+ * A handy Yes/No/Cancel dialog. >+ */ >+public class HandyPromptDialog extends HandyDialog implements IHandyPromptDialog { >+ private static class ButtonDetails extends Object { >+ private Button button; >+ private boolean selected; >+ private String text; >+ } >+ >+ private static final String PROMPT_KEY = "HandyPromptDialog.Prompt"; //$NON-NLS-1$ >+ private static final String UNKNOWN_BUTTON_ID_KEY = "HandyPromptDialog.UnknownButtonId"; //$NON-NLS-1$ >+ >+ private static final int NO_DEFAULT_BUTTON_ID = -1; >+ >+ private String cancelButtonText; >+ private List/*<ButtonDetails>*/ checkboxButtons; >+ private String checkboxGroupText; >+ private int defaultButtonId; >+ private Image image; >+ private String noButtonText; >+ private String prompt; >+ private List/*<ButtonDetails>*/ radioButtons; >+ private String radioButtonGroupText; >+ private String yesButtonText; >+ >+ public HandyPromptDialog(Shell parentShell, String prompt) { >+ super(parentShell); >+ setTitle(Messages.HandyPromptDialog_Prompt); >+ setPrompt(prompt); >+ initializeCheckboxButtons(); >+ initializeRadioButtons(); >+ initializePushButtons(); >+ setDefaultButtonId(HandyPromptDialog.NO_DEFAULT_BUTTON_ID); >+ } >+ >+ private int addButton(List/*<ButtonDetails>*/ list, String text, boolean selected) { >+ synchronized (list) { >+ int size = list.size(); >+ ButtonDetails details = new ButtonDetails(); >+ details.text = text; >+ details.selected = selected; >+ list.add(details); >+ return size; >+ } >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#addCheckbox(java.lang.String, boolean) >+ */ >+ public int addCheckbox(String text, boolean selected) { >+ List/*<ButtonDetails>*/ list = getCheckboxButtons(); >+ int id = addButton(list, text, selected); >+ return id; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#addRadioButton(java.lang.String, boolean) >+ */ >+ public int addRadioButton(String text, boolean selected) { >+ List/*<ButtonDetails>*/ list = getRadioButtons(); >+ int id = addButton(list, text, selected); >+ return id; >+ } >+ >+ /** >+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) >+ */ >+ protected void buttonPressed(int buttonId) { >+ try { >+ updateButtonSelections(); >+ setReturnCode(buttonId); >+ } finally { >+ close(); >+ } >+ } >+ >+ private void checkButtonId(List/*<ButtonDetails>*/ list, int id) { >+ int size = list.size(); >+ if (id < size) >+ return; // Early return. >+ >+ String pattern = Messages.HandyPromptDialog_UnknownButtonId; >+ Object[] values = new Object[] { >+ new Integer(id) >+ }; >+ String message = MessageFormat.format(pattern, values); >+ throw new IllegalArgumentException(message); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.internal.HandyDialog#createArea(org.eclipse.swt.widgets.Composite) >+ */ >+ protected void createArea(Composite composite) { >+ createPromptControls(composite); >+ } >+ >+ private Button createButton(Composite parent, int id, String label) { >+ int defaultButtonId = getDefaultButtonId(); >+ boolean defaultButton = defaultButtonId == id; >+ Button button = createButton(parent, id, label, defaultButton); >+ return button; >+ } >+ >+ /** >+ * @see org.eclipse.jface.dialogs.Dialog#createButton(org.eclipse.swt.widgets.Composite, int, java.lang.String, boolean) >+ */ >+ protected Button createButton(Composite parent, int id, String label, boolean defaultButton) { >+ Button button = super.createButton(parent, id, label, defaultButton); >+ >+ // Force the default button to take focus. This fixes an apparent >+ // bug in SWT where the default button does not always take focus. >+ // Strangely enough, the default button seems to take focus when the >+ // HandyPromptDialog has at least one radio button or checkbox. >+ >+ if (defaultButton == true) { >+ button.setFocus(); >+ } >+ >+ return button; >+ } >+ >+ private void createButtons(List/* <ButtonDetails> */list, >+ Composite parent, boolean grabExcessSpace, String groupText, >+ int style) { >+ synchronized (list) { >+ boolean empty = list.isEmpty(); >+ if (empty == true) >+ return; // Early return. >+ >+ Composite composite; >+ RowLayout layout = new RowLayout(SWT.VERTICAL); >+ >+ if (groupText == null) { >+ composite = new Composite(parent, SWT.NONE); >+ layout.marginLeft = 0; >+ layout.marginRight = 0; >+ layout.marginTop = 0; >+ layout.marginBottom = 0; >+ } else { >+ Group group = new Group(parent, SWT.NONE); >+ group.setText(groupText); >+ composite = group; >+ } >+ >+ composite.setLayout(layout); >+ >+ int alignment = grabExcessSpace == true ? SWT.FILL : SWT.BEGINNING; >+ Object data = new GridData(alignment, alignment, grabExcessSpace, grabExcessSpace); >+ composite.setLayoutData(data); >+ >+ Iterator/*<ButtonDetails>*/ iterator = list.iterator(); >+ while (iterator.hasNext() == true) { >+ ButtonDetails details = (ButtonDetails) iterator.next(); >+ Button button = new Button(composite, style); >+ button.setText(details.text); >+ button.setSelection(details.selected); >+ details.button = button; >+ } >+ } >+ } >+ >+ /** >+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) >+ */ >+ protected void createButtonsForButtonBar(Composite parent) { >+ createYesButtonForButtonBar(parent); >+ createNoButtonForButtonBar(parent); >+ createCancelButtonForButtonBar(parent); >+ } >+ >+ private Button createCancelButtonForButtonBar(Composite parent) { >+ String label = getCancelButtonText(); >+ if (label == null) >+ return null; // Early return. >+ int id = IHandyDialog.CANCEL_ID; >+ Button button = createButton(parent, id, label); >+ return button; >+ } >+ >+ private Button createNoButtonForButtonBar(Composite parent) { >+ String label = getNoButtonText(); >+ if (label == null) >+ return null; // Early return. >+ int id = IHandyDialog.NO_ID; >+ Button button = createButton(parent, id, label); >+ return button; >+ } >+ >+ private void createPromptButtonControls(Composite parent) { >+ int columns = 0; >+ >+ List/*<ButtonDetails>*/ checkboxButtons = getCheckboxButtons(); >+ boolean hasCheckboxButtons = checkboxButtons.isEmpty() == false; >+ >+ if (hasCheckboxButtons == true) { >+ columns++; >+ } >+ >+ List/*<ButtonDetails>*/ radioButtons = getRadioButtons(); >+ boolean hasRadioButtons = radioButtons.isEmpty() == false; >+ >+ if (hasRadioButtons == true) { >+ columns++; >+ } >+ >+ if (columns == 0) >+ return; // Early return. >+ >+ Composite composite = createPromptButtonControlsComposite(parent, columns); >+ >+ if (hasCheckboxButtons == true) { >+ String groupText = getCheckboxGroupText(); >+ createButtons(checkboxButtons, composite, hasRadioButtons, groupText, SWT.CHECK); >+ } >+ >+ if (hasRadioButtons == true) { >+ String groupText = getRadioButtonGroupText(); >+ createButtons(radioButtons, composite, hasCheckboxButtons, groupText, SWT.RADIO); >+ } >+ } >+ >+ private Composite createPromptButtonControlsComposite(Composite parent, int columns) { >+ GridLayout layout = new GridLayout(columns, false); >+ layout.marginWidth = 0; >+ layout.marginHeight = 0; >+ layout.marginTop = 20; >+ layout.marginHeight = 0; >+ >+ if (columns > 1) { >+ layout.horizontalSpacing = 10; >+ } >+ >+ Composite composite = new Composite(parent, SWT.NONE); >+ composite.setLayout(layout); >+ >+ Object data = new GridData(SWT.FILL, SWT.FILL, true, false); >+ composite.setLayoutData(data); >+ >+ return composite; >+ } >+ >+ private void createPromptControls(Composite parent) { >+ createPromptLabelControls(parent); >+ createPromptButtonControls(parent); >+ } >+ >+ private void createPromptLabelControls(Composite parent) { >+ GridData data; >+ >+ Composite composite = new Composite(parent, SWT.NONE); >+ GridLayout layout = new GridLayout(2, false); >+ layout.marginWidth = 0; >+ layout.marginHeight = 0; >+ composite.setLayout(layout); >+ data = new GridData(SWT.FILL, SWT.FILL, true, true); >+ composite.setLayoutData(data); >+ >+ Label icon = new Label(composite, SWT.LEFT | SWT.NONE); >+ Image image = getImage(); >+ icon.setImage(image); >+ >+ Label label = new Label(composite, SWT.WRAP); >+ String prompt = getPrompt(); >+ label.setText(prompt); >+ data = new GridData(SWT.FILL, SWT.CENTER, true, true); >+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); >+ label.setLayoutData(data); >+ } >+ >+ private Button createYesButtonForButtonBar(Composite parent) { >+ String label = getYesButtonText(); >+ if (label == null) >+ return null; // Early return. >+ int id = IHandyDialog.YES_ID; >+ Button button = createButton(parent, id, label); >+ return button; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#defaultButtonIsCancel() >+ */ >+ public void defaultButtonIsCancel() { >+ setDefaultButtonId(IHandyDialog.CANCEL_ID); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#defaultButtonIsNo() >+ */ >+ public void defaultButtonIsNo() { >+ setDefaultButtonId(IHandyDialog.NO_ID); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#defaultButtonIsYes() >+ */ >+ public void defaultButtonIsYes() { >+ setDefaultButtonId(IHandyDialog.YES_ID); >+ } >+ >+ private ButtonDetails getButtonDetails(List/*<ButtonDetails>*/ list, int id) { >+ checkButtonId(list, id); >+ ButtonDetails details = (ButtonDetails) list.get(id); >+ return details; >+ } >+ >+ private String getCancelButtonText() { >+ return cancelButtonText; >+ } >+ >+ private ButtonDetails getCheckboxButtonDetails(int id) { >+ List/*<ButtonDetails>*/ list = getCheckboxButtons(); >+ ButtonDetails details = getButtonDetails(list, id); >+ return details; >+ } >+ >+ private List/*<ButtonDetails>*/ getCheckboxButtons() { >+ return checkboxButtons; >+ } >+ >+ private String getCheckboxGroupText() { >+ return checkboxGroupText; >+ } >+ >+ private int getDefaultButtonId() { >+ synchronized (this) { >+ if (defaultButtonId == -1) { >+ int id = guessDefaultButtonId(); >+ setDefaultButtonId(id); >+ } >+ } >+ >+ return defaultButtonId; >+ } >+ >+ private Image getImage() { >+ synchronized (this) { >+ if (image == null) { >+ useInformationIcon(); >+ } >+ } >+ return image; >+ } >+ >+ private String getNoButtonText() { >+ return noButtonText; >+ } >+ >+ private String getPrompt() { >+ return prompt; >+ } >+ >+ private ButtonDetails getRadioButtonDetails(int id) { >+ List/*<ButtonDetails>*/ list = getRadioButtons(); >+ ButtonDetails details = getButtonDetails(list, id); >+ return details; >+ } >+ >+ private String getRadioButtonGroupText() { >+ return radioButtonGroupText; >+ } >+ >+ private List/*<ButtonDetails>*/ getRadioButtons() { >+ return radioButtons; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#getSelectedRadioButtonId() >+ */ >+ public int getSelectedRadioButtonId() { >+ List/*<ButtonDetails>*/ list = getRadioButtons(); >+ int size = list.size(); >+ >+ for (int id = 0; id < size; id++) { >+ ButtonDetails details = (ButtonDetails) list.get(id); >+ if (details.selected == true) >+ return id; // Early return. >+ } >+ >+ return -1; >+ } >+ >+ private String getYesButtonText() { >+ return yesButtonText; >+ } >+ >+ private int guessDefaultButtonId() { >+ Object text; >+ >+ text = getCancelButtonText(); >+ if (text != null) return IHandyDialog.CANCEL_ID; >+ >+ text = getNoButtonText(); >+ if (text != null) return IHandyDialog.NO_ID; >+ >+ text = getYesButtonText(); >+ if (text != null) return IHandyDialog.YES_ID; >+ >+ return HandyPromptDialog.NO_DEFAULT_BUTTON_ID; >+ } >+ >+ private void initializeCheckboxButtons() { >+ setCheckboxButtons(new ArrayList/*<ButtonDetails>*/(3)); >+ } >+ >+ private void initializePushButtons() { >+ setYesButtonText(IDialogConstants.YES_LABEL); >+ setNoButtonText(IDialogConstants.NO_LABEL); >+ setCancelButtonText('&' + IDialogConstants.CANCEL_LABEL); >+ } >+ >+ private void initializeRadioButtons() { >+ setRadioButtons(new ArrayList/*<ButtonDetails>*/(3)); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#isCheckboxSelected(int) >+ */ >+ public boolean isCheckboxSelected(int id) { >+ ButtonDetails details = getCheckboxButtonDetails(id); >+ return details.selected; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#removeAllCheckboxes() >+ */ >+ public void removeAllCheckboxes() { >+ initializeCheckboxButtons(); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#removeAllRadioButtons() >+ */ >+ public void removeAllRadioButtons() { >+ initializeRadioButtons(); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#setCancelButtonText(java.lang.String) >+ */ >+ public void setCancelButtonText(String cancelButtonText) { >+ this.cancelButtonText = cancelButtonText; >+ } >+ >+ private void setCheckboxButtons(List/*<ButtonDetails>*/ checkboxButtons) { >+ this.checkboxButtons = checkboxButtons; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#setCheckboxGroupText(java.lang.String) >+ */ >+ public void setCheckboxGroupText(String checkboxGroupText) { >+ this.checkboxGroupText = checkboxGroupText; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#setCheckboxSelected(int, boolean) >+ */ >+ public void setCheckboxSelected(int id, boolean selected) { >+ ButtonDetails details = getCheckboxButtonDetails(id); >+ details.selected = selected; >+ } >+ >+ private void setDefaultButtonId(int defaultButtonId) { >+ this.defaultButtonId = defaultButtonId; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#setImage(org.eclipse.swt.graphics.Image) >+ */ >+ public void setImage(Image image) { >+ this.image = image; >+ } >+ >+ private void setImage(int id) { >+ Image image = getSystemImage(id); >+ setImage(image); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#setNoButtonText(java.lang.String) >+ */ >+ public void setNoButtonText(String noButtonText) { >+ this.noButtonText = noButtonText; >+ } >+ >+ private void setPrompt(String prompt) { >+ this.prompt = prompt; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#setRadioButtonGroupText(java.lang.String) >+ */ >+ public void setRadioButtonGroupText(String radioButtonGroupText) { >+ this.radioButtonGroupText = radioButtonGroupText; >+ } >+ >+ private void setRadioButtons(List/*<ButtonDetails>*/ radioButtons) { >+ this.radioButtons = radioButtons; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#setRadioButtonSelected(int, boolean) >+ */ >+ public void setRadioButtonSelected(int id, boolean selected) { >+ ButtonDetails details = getRadioButtonDetails(id); >+ details.selected = selected; >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#setYesButtonText(java.lang.String) >+ */ >+ public void setYesButtonText(String yesButtonText) { >+ this.yesButtonText = yesButtonText; >+ } >+ >+ private void updateButtonSelections() { >+ updateCheckboxButtonSelections(); >+ updateRadioButtonSelections(); >+ } >+ >+ private void updateButtonSelections(List/*<ButtonDetails>*/ list) { >+ synchronized (list) { >+ Iterator/*<ButtonDetails>*/ iterator = list.iterator(); >+ while (iterator.hasNext() == true) { >+ ButtonDetails details = (ButtonDetails) iterator.next(); >+ details.selected = details.button.getSelection(); >+ } >+ } >+ } >+ >+ private void updateCheckboxButtonSelections() { >+ List/*<ButtonDetails>*/ list = getCheckboxButtons(); >+ updateButtonSelections(list); >+ } >+ >+ private void updateRadioButtonSelections() { >+ List/*<ButtonDetails>*/ list = getRadioButtons(); >+ updateButtonSelections(list); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#useErrorIcon() >+ */ >+ public void useErrorIcon() { >+ setImage(SWT.ICON_ERROR); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#useInformationIcon() >+ */ >+ public void useInformationIcon() { >+ setImage(SWT.ICON_INFORMATION); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#useQuestionIcon() >+ */ >+ public void useQuestionIcon() { >+ setImage(SWT.ICON_QUESTION); >+ } >+ >+ /** >+ * @see org.eclipse.soda.sat.plugin.ui.util.IHandyPromptDialog#useWarningIcon() >+ */ >+ public void useWarningIcon() { >+ setImage(SWT.ICON_WARNING); >+ } >+}
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 256731
:
119534
|
119535
|
119573
|
119574
| 120039