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 20435 Details for
Bug 93061
User library should allow classpath variables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch to jdtui for this functionality
variable-userlib-jdtui.patch (text/plain), 17.60 KB, created by
Matthew Conway
on 2005-04-27 22:54:10 EDT
(
hide
)
Description:
patch to jdtui for this functionality
Filename:
MIME Type:
Creator:
Matthew Conway
Created:
2005-04-27 22:54:10 EDT
Size:
17.60 KB
patch
obsolete
>Index: ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties,v >retrieving revision 1.278 >diff -u -r1.278 PreferencesMessages.properties >--- ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties 31 Mar 2005 14:39:12 -0000 1.278 >+++ ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties 28 Apr 2005 02:36:25 -0000 >@@ -688,6 +688,7 @@ > UserLibraryPreferencePage.libraries.new.button=&New... > UserLibraryPreferencePage.libraries.edit.button=&Edit... > UserLibraryPreferencePage.libraries.addjar.button=Add &JARs... >+UserLibraryPreferencePage.libraries.addvar.button=Add &Variable... > UserLibraryPreferencePage.libraries.remove.button=&Remove... > UserLibraryPreferencePage.libraries.load.button=I&mport... > UserLibraryPreferencePage.libraries.save.button=E&xport... >Index: ui/org/eclipse/jdt/internal/ui/preferences/UserLibraryPreferencePage.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/UserLibraryPreferencePage.java,v >retrieving revision 1.29 >diff -u -r1.29 UserLibraryPreferencePage.java >--- ui/org/eclipse/jdt/internal/ui/preferences/UserLibraryPreferencePage.java 29 Mar 2005 14:59:17 -0000 1.29 >+++ ui/org/eclipse/jdt/internal/ui/preferences/UserLibraryPreferencePage.java 28 Apr 2005 02:36:26 -0000 >@@ -36,17 +36,6 @@ > import javax.xml.transform.dom.DOMSource; > import javax.xml.transform.stream.StreamResult; > >-import org.w3c.dom.Document; >-import org.w3c.dom.Element; >-import org.w3c.dom.Node; >-import org.w3c.dom.NodeList; >-import org.xml.sax.InputSource; >-import org.xml.sax.SAXException; >- >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.IWorkspaceRoot; >-import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -55,6 +44,11 @@ > import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.core.runtime.Path; > >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IWorkspaceRoot; >+import org.eclipse.core.resources.ResourcesPlugin; >+ > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.KeyEvent; > import org.eclipse.swt.graphics.Point; >@@ -102,7 +96,26 @@ > import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElementSorter; > import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListLabelProvider; > import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPUserLibraryElement; >-import org.eclipse.jdt.internal.ui.wizards.dialogfields.*; >+import org.eclipse.jdt.internal.ui.wizards.buildpaths.NewVariableEntryDialog; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.CheckedListDialogField; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.ITreeListAdapter; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonDialogField; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField; >+import org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField; >+ >+import org.w3c.dom.Document; >+import org.w3c.dom.Element; >+import org.w3c.dom.Node; >+import org.w3c.dom.NodeList; >+import org.xml.sax.InputSource; >+import org.xml.sax.SAXException; > > public class UserLibraryPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { > >@@ -203,7 +216,9 @@ > private static final String TAG_VERSION= "version"; //$NON-NLS-1$ > private static final String TAG_LIBRARY= "library"; //$NON-NLS-1$ > private static final String TAG_SOURCEATTACHMENT= "source"; //$NON-NLS-1$ >- private static final String TAG_ARCHIVE_PATH= "path"; //$NON-NLS-1$ >+ private static final String TAG_ARCHIVE_PATH= "path"; //$NON-NLS-1$ >+ private static final String TAG_ARCHIVE_TYPE= "type"; //$NON-NLS-1$ >+ private static final String TAG_TYPE_VAR= "var"; //$NON-NLS-1$ > private static final String TAG_ARCHIVE= "archive"; //$NON-NLS-1$ > private static final String TAG_SYSTEMLIBRARY= "systemlibrary"; //$NON-NLS-1$ > private static final String TAG_NAME= "name"; //$NON-NLS-1$ >@@ -528,7 +543,10 @@ > > Element childElement= document.createElement(TAG_ARCHIVE); > libraryElement.appendChild(childElement); >- >+ >+ if (child.getEntryKind() == IClasspathEntry.CPE_VARIABLE) { >+ childElement.setAttribute(TAG_ARCHIVE_TYPE, TAG_TYPE_VAR); >+ } > childElement.setAttribute(TAG_ARCHIVE_PATH, child.getPath().toPortableString()); > IPath sourceAttachment= (IPath) child.getAttribute(CPListElement.SOURCEATTACHMENT); > if (sourceAttachment != null) { >@@ -609,8 +627,14 @@ > } > Element archiveElement= (Element) archiveNode; > >+ String type = archiveElement.getAttribute(TAG_ARCHIVE_TYPE); >+ int cetype = IClasspathEntry.CPE_LIBRARY; >+ if (TAG_TYPE_VAR.equals(type)) >+ { >+ cetype = IClasspathEntry.CPE_VARIABLE; >+ } > String path= archiveElement.getAttribute(TAG_ARCHIVE_PATH); >- CPListElement newArchive= new CPListElement(newLibrary, null, IClasspathEntry.CPE_LIBRARY, Path.fromPortableString(path), null); >+ CPListElement newArchive= new CPListElement(newLibrary, null, cetype, Path.fromPortableString(path), null); > newLibrary.add(newArchive); > > if (archiveElement.hasAttribute(TAG_SOURCEATTACHMENT)) { >@@ -637,10 +661,11 @@ > > private static final int IDX_NEW= 0; > private static final int IDX_EDIT= 1; >- private static final int IDX_ADD= 2; >- private static final int IDX_REMOVE= 3; >- private static final int IDX_LOAD= 5; >- private static final int IDX_SAVE= 6; >+ private static final int IDX_ADD= 2; >+ private static final int IDX_ADDVAR= 3; >+ private static final int IDX_REMOVE= 4; >+ private static final int IDX_LOAD= 6; >+ private static final int IDX_SAVE= 7; > > /** > * Constructor for ClasspathVariablesPreferencePage >@@ -660,7 +685,8 @@ > String[] buttonLabels= new String[] { > PreferencesMessages.getString("UserLibraryPreferencePage.libraries.new.button"), //$NON-NLS-1$ > PreferencesMessages.getString("UserLibraryPreferencePage.libraries.edit.button"), //$NON-NLS-1$ >- PreferencesMessages.getString("UserLibraryPreferencePage.libraries.addjar.button"), //$NON-NLS-1$ >+ PreferencesMessages.getString("UserLibraryPreferencePage.libraries.addjar.button"), //$NON-NLS-1$ >+ PreferencesMessages.getString("UserLibraryPreferencePage.libraries.addvar.button"), //$NON-NLS-1$ > PreferencesMessages.getString("UserLibraryPreferencePage.libraries.remove.button"), //$NON-NLS-1$ > null, > PreferencesMessages.getString("UserLibraryPreferencePage.libraries.load.button"), //$NON-NLS-1$ >@@ -900,15 +926,18 @@ > List list= field.getSelectedElements(); > field.enableButton(IDX_REMOVE, canRemove(list)); > field.enableButton(IDX_EDIT, canEdit(list)); >- field.enableButton(IDX_ADD, canAdd(list)); >+ field.enableButton(IDX_ADD, canAdd(list)); >+ field.enableButton(IDX_ADDVAR, canAdd(list)); > field.enableButton(IDX_SAVE, field.getSize() > 0); > } > > protected void doCustomButtonPressed(TreeListDialogField field, int index) { > if (index == IDX_NEW) { > editUserLibraryElement(null); >- } else if (index == IDX_ADD) { >- doAdd(field.getSelectedElements()); >+ } else if (index == IDX_ADD) { >+ doAdd(field.getSelectedElements()); >+ } else if (index == IDX_ADDVAR) { >+ doAddVar(field.getSelectedElements()); > } else if (index == IDX_REMOVE) { > doRemove(field.getSelectedElements()); > } else if (index == IDX_EDIT) { >@@ -944,8 +973,15 @@ > } else if (curr instanceof CPUserLibraryElement) { > editUserLibraryElement((CPUserLibraryElement) curr); > } else if (curr instanceof CPListElement) { >- CPListElement elem= (CPListElement) curr; >- editArchiveElement(elem, (CPUserLibraryElement) elem.getParentContainer()); >+ CPListElement elem= (CPListElement) curr; >+ if (elem.getEntryKind() == IClasspathEntry.CPE_VARIABLE) >+ { >+ editVariableElement(elem, (CPUserLibraryElement) elem.getParentContainer()); >+ } >+ else >+ { >+ editArchiveElement(elem, (CPUserLibraryElement) elem.getParentContainer()); >+ } > } > } > } >@@ -964,22 +1000,54 @@ > } > } > >- private void editArchiveElement(CPListElement existingElement, CPUserLibraryElement parent) { >- CPListElement[] elements= openExtJarFileDialog(existingElement, parent); >- if (elements != null) { >- for (int i= 0; i < elements.length; i++) { >- if (existingElement != null) { >- parent.replace(existingElement, elements[i]); >- } else { >- parent.add(elements[i]); >- } >- } >- fLibraryList.refresh(parent); >- fLibraryList.expandElement(parent, AbstractTreeViewer.ALL_LEVELS); >- fLibraryList.selectElements(new StructuredSelection(parent)); >- } >- } >- >+ private void editArchiveElement(CPListElement existingElement, CPUserLibraryElement parent) { >+ CPListElement[] elements= openExtJarFileDialog(existingElement, parent); >+ if (elements != null) { >+ for (int i= 0; i < elements.length; i++) { >+ if (existingElement != null) { >+ parent.replace(existingElement, elements[i]); >+ } else { >+ parent.add(elements[i]); >+ } >+ } >+ fLibraryList.refresh(parent); >+ fLibraryList.expandElement(parent, AbstractTreeViewer.ALL_LEVELS); >+ fLibraryList.selectElements(new StructuredSelection(parent)); >+ } >+ } >+ >+ private void editVariableElement(CPListElement existingElement, CPUserLibraryElement parent) { >+ CPListElement[] elements= openVariableDialog(existingElement, parent); >+ if (elements != null) { >+ for (int i= 0; i < elements.length; i++) { >+ if (existingElement != null) { >+ parent.replace(existingElement, elements[i]); >+ } else { >+ parent.add(elements[i]); >+ } >+ } >+ fLibraryList.refresh(parent); >+ fLibraryList.expandElement(parent, AbstractTreeViewer.ALL_LEVELS); >+ fLibraryList.selectElements(new StructuredSelection(parent)); >+ } >+ } >+ >+ private CPListElement[] openVariableDialog(CPListElement existing, Object parent) { >+ NewVariableEntryDialog dialog= new NewVariableEntryDialog(getShell(), true); >+ if (dialog.open() != Window.OK) { >+ return null; >+ } >+ >+ IPath[] varPaths = dialog.getResult(); >+ CPListElement[] elems= new CPListElement[varPaths.length]; >+ for (int i= 0; i < varPaths.length; i++) { >+ CPListElement curr= new CPListElement(parent, null, IClasspathEntry.CPE_VARIABLE, varPaths[i], null); >+ curr.setAttribute(CPListElement.SOURCEATTACHMENT, BuildPathSupport.guessSourceAttachment(curr)); >+ curr.setAttribute(CPListElement.JAVADOC, BuildPathSupport.guessJavadocLocation(curr)); >+ elems[i]= curr; >+ } >+ return elems; >+ } > > private void doRemove(List selected) { > Object selectionAfter= null; >@@ -1010,13 +1078,20 @@ > } > } > >- private void doAdd(List list) { >- if (canAdd(list)) { >- CPUserLibraryElement element= getSingleSelectedLibrary(list); >- editArchiveElement(null, element); >- } >- } >- >+ private void doAdd(List list) { >+ if (canAdd(list)) { >+ CPUserLibraryElement element= getSingleSelectedLibrary(list); >+ editArchiveElement(null, element); >+ } >+ } >+ >+ private void doAddVar(List list) { >+ if (canAdd(list)) { >+ CPUserLibraryElement element= getSingleSelectedLibrary(list); >+ editVariableElement(null, element); >+ } >+ } >+ > private void doLoad() { > List existing= fLibraryList.getElements(); > LoadSaveDialog dialog= new LoadSaveDialog(getShell(), false, existing, fDialogSettings); >Index: ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPUserLibraryElement.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPUserLibraryElement.java,v >retrieving revision 1.8 >diff -u -r1.8 CPUserLibraryElement.java >--- ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPUserLibraryElement.java 23 Mar 2005 12:02:15 -0000 1.8 >+++ ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPUserLibraryElement.java 28 Apr 2005 02:36:28 -0000 >@@ -72,7 +72,7 @@ > CPListElement[] res= new CPListElement[entries.length]; > for (int i= 0; i < res.length; i++) { > IClasspathEntry curr= entries[i]; >- CPListElement elem= CPListElement.createFromExisting(curr, project); >+ CPListElement elem= CPListElement.createFromExisting(this, curr, project); > //elem.setAttribute(CPListElement.SOURCEATTACHMENT, curr.getSourceAttachmentPath()); > //elem.setAttribute(CPListElement.JAVADOC, JavaUI.getLibraryJavadocLocation(curr.getPath())); > fChildren.add(elem); >Index: ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/NewVariableEntryDialog.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/NewVariableEntryDialog.java,v >retrieving revision 1.26 >diff -u -r1.26 NewVariableEntryDialog.java >--- ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/NewVariableEntryDialog.java 29 Mar 2005 14:59:17 -0000 1.26 >+++ ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/NewVariableEntryDialog.java 28 Apr 2005 02:36:28 -0000 >@@ -27,6 +27,11 @@ > import org.eclipse.swt.widgets.Shell; > > import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.preference.IPreferenceNode; >+import org.eclipse.jface.preference.IPreferencePage; >+import org.eclipse.jface.preference.PreferenceDialog; >+import org.eclipse.jface.preference.PreferenceManager; >+import org.eclipse.jface.preference.PreferenceNode; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.jface.viewers.ViewerSorter; > import org.eclipse.jface.window.Window; >@@ -89,10 +94,16 @@ > > private IPath[] fResultPaths; > >+ private boolean useDialogForConfig = false; > private SelectionButtonDialogField fConfigButton; > >- public NewVariableEntryDialog(Shell parent) { >+ public NewVariableEntryDialog(Shell parent) { >+ this(parent, true); >+ } >+ >+ public NewVariableEntryDialog(Shell parent, boolean useDialogForConfig) { > super(parent); >+ this.useDialogForConfig = useDialogForConfig; > setTitle(NewWizardMessages.getString("NewVariableEntryDialog.title")); //$NON-NLS-1$ > > int shellStyle= getShellStyle(); >@@ -122,12 +133,10 @@ > } > }); > >- >- fConfigButton= new SelectionButtonDialogField(SWT.PUSH); >- fConfigButton.setLabelText(NewWizardMessages.getString("NewVariableEntryDialog.configbutton.label")); //$NON-NLS-1$ >- fConfigButton.setDialogFieldListener(adapter); >- >- initializeElements(); >+ fConfigButton= new SelectionButtonDialogField(SWT.PUSH); >+ fConfigButton.setLabelText(NewWizardMessages.getString("NewVariableEntryDialog.configbutton.label")); //$NON-NLS-1$ >+ fConfigButton.setDialogFieldListener(adapter); >+ initializeElements(); > > fCanExtend= false; > fIsValidSelection= false; >@@ -182,8 +191,8 @@ > layout.marginHeight= 0; > layout.marginWidth= 0; > lowerComposite.setLayout(layout); >- >- fConfigButton.doFillIntoGrid(lowerComposite, 1); >+ >+ fConfigButton.doFillIntoGrid(lowerComposite, 1); > > applyDialogFont(composite); > return composite; >@@ -277,7 +286,21 @@ > > protected final void configButtonPressed() { > String id= ClasspathVariablesPreferencePage.ID; >- PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, null).open(); >+ if (useDialogForConfig) >+ { >+ IPreferencePage page = new ClasspathVariablesPreferencePage(); >+ IPreferenceNode targetNode = new PreferenceNode(id, page); >+ PreferenceManager manager = new PreferenceManager(); >+ manager.addToRoot(targetNode); >+ PreferenceDialog dialog = new PreferenceDialog(getShell(), manager); >+ dialog.create(); >+ dialog.setMessage(targetNode.getLabelText()); >+ dialog.open(); >+ } >+ else >+ { >+ PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, null).open(); >+ } > initializeElements(); > } >
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 93061
:
20434
|
20435
|
20529
|
20530