issue_id
int64
2.03k
426k
title
stringlengths
9
251
body
stringlengths
1
32.8k
status
stringclasses
6 values
after_fix_sha
stringlengths
7
7
project_name
stringclasses
6 values
repo_url
stringclasses
6 values
repo_name
stringclasses
6 values
language
stringclasses
1 value
issue_url
null
before_fix_sha
null
pull_url
null
commit_datetime
timestamp[us, tz=UTC]
report_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
2
187
file_content
stringlengths
0
368k
27,429
Bug 27429 [Dialogs] Space usage of type info cache
null
closed fixed
3ae6b79
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-13T10:26:36Z
2002-11-29T20:00:00Z
extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java
27,429
Bug 27429 [Dialogs] Space usage of type info cache
null
closed fixed
3ae6b79
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-13T10:26:36Z
2002-11-29T20:00:00Z
org.eclipse.jdt.ui/core
27,429
Bug 27429 [Dialogs] Space usage of type info cache
null
closed fixed
3ae6b79
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-13T10:26:36Z
2002-11-29T20:00:00Z
extension/org/eclipse/jdt/internal/corext/util/TypeInfoFactory.java
27,429
Bug 27429 [Dialogs] Space usage of type info cache
null
closed fixed
3ae6b79
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-13T10:26:36Z
2002-11-29T20:00:00Z
org.eclipse.jdt.ui/core
27,429
Bug 27429 [Dialogs] Space usage of type info cache
null
closed fixed
3ae6b79
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-13T10:26:36Z
2002-11-29T20:00:00Z
extension/org/eclipse/jdt/internal/corext/util/TypeInfoRequestor.java
27,429
Bug 27429 [Dialogs] Space usage of type info cache
null
closed fixed
3ae6b79
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-13T10:26:36Z
2002-11-29T20:00:00Z
org.eclipse.jdt.ui/core
27,429
Bug 27429 [Dialogs] Space usage of type info cache
null
closed fixed
3ae6b79
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-13T10:26:36Z
2002-11-29T20:00:00Z
extension/org/eclipse/jdt/internal/corext/util/UnresolvedTypeInfo.java
28,166
Bug 28166 Selecting an element in package view is eagerly populating the Java model
Build 20021210 Without even expanding any node, the UI will cause the model to be populated as soon as a node is selected (seems like it is precomputing action to put in the menu). So if simply navigating amongst items in the tree, it will cause lots of activity which is mostly useless. at org.eclipse.jdt.internal.core.PackageFragment.openWhenClosed (PackageFragment.java:313) at org.eclipse.jdt.internal.core.JavaElement.openHierarchy (JavaElement.java:509) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo (JavaElement.java:296) at org.eclipse.jdt.internal.core.JavaElement.getChildren (JavaElement.java:252) at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType (JavaElement.java:261) at org.eclipse.jdt.internal.core.PackageFragment.getCompilationUnits (PackageFragment.java:190) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.isEnabled (OrganizeImportsAction.java:213) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.selectionChanged (OrganizeImportsAction.java:148) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged (SelectionDispatchAction.java:181) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged (SelectionDispatchAction.java:176) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged (Viewer.java:148) at org.eclipse.jface.viewers.StructuredViewer.updateSelection (StructuredViewer.java:1151) at org.eclipse.jface.viewers.StructuredViewer.handleSelect (StructuredViewer.java:540) at org.eclipse.jface.viewers.StructuredViewer$1.widgetSelected (StructuredViewer.java:564) at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent (OpenStrategy.java:172) at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:167) at org.eclipse.jface.util.OpenStrategy$1.handleEvent (OpenStrategy.java:302) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1403) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1386) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
resolved fixed
b3290af
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-16T09:11:02Z
2002-12-12T13:33:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
/******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.ui.actions; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.window.Window; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.ui.IEditorActionBarContributor; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.part.EditorActionBarContributor; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.ISourceRange; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.corext.ValidateEditException; import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation; import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.IChooseImportQuery; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.internal.corext.util.TypeInfo; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.actions.ActionMessages; import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter; import org.eclipse.jdt.internal.ui.dialogs.MultiElementListSelectionDialog; import org.eclipse.jdt.internal.ui.dialogs.ProblemDialog; import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext; import org.eclipse.jdt.internal.ui.util.ElementValidator; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; import org.eclipse.jdt.internal.ui.util.TypeInfoLabelProvider; import org.eclipse.jdt.ui.IWorkingCopyManager; import org.eclipse.jdt.ui.JavaUI; import org.eclipse.jdt.ui.PreferenceConstants; /** * Organizes the imports of a compilation unit. * <p> * The action is applicable to selections containing elements of * type <code>ICompilationUnit</code> or <code>IPackage * </code>. * * <p> * This class may be instantiated; it is not intended to be subclassed. * </p> * * @since 2.0 */ public class OrganizeImportsAction extends SelectionDispatchAction { private JavaEditor fEditor; /* (non-Javadoc) * Class implements IObjectActionDelegate */ public static class ObjectDelegate implements IObjectActionDelegate { private OrganizeImportsAction fAction; public void setActivePart(IAction action, IWorkbenchPart targetPart) { fAction= new OrganizeImportsAction(targetPart.getSite()); } public void run(IAction action) { fAction.run(); } public void selectionChanged(IAction action, ISelection selection) { if (fAction == null) action.setEnabled(false); } } /** * Creates a new <code>OrganizeImportsAction</code>. The action requires * that the selection provided by the site's selection provider is of type <code> * org.eclipse.jface.viewers.IStructuredSelection</code>. * * @param site the site providing context information for this action */ public OrganizeImportsAction(IWorkbenchSite site) { super(site); setText(ActionMessages.getString("OrganizeImportsAction.label")); //$NON-NLS-1$ setToolTipText(ActionMessages.getString("OrganizeImportsAction.tooltip")); //$NON-NLS-1$ setDescription(ActionMessages.getString("OrganizeImportsAction.description")); //$NON-NLS-1$ WorkbenchHelp.setHelp(this, IJavaHelpContextIds.ORGANIZE_IMPORTS_ACTION); } /** * Note: This constructor is for internal use only. Clients should not call this constructor. */ public OrganizeImportsAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; } /* (non-Javadoc) * Method declared on SelectionDispatchAction. */ protected void selectionChanged(ITextSelection selection) { // do nothing } /* (non-Javadoc) * Method declared on SelectionDispatchAction. */ protected void selectionChanged(IStructuredSelection selection) { setEnabled(isEnabled(selection)); } private ICompilationUnit[] getCompilationUnits(IStructuredSelection selection) { HashSet result= new HashSet(); Object[] selected= selection.toArray(); for (int i= 0; i < selected.length; i++) { try { if (selected[i] instanceof IJavaElement) { IJavaElement elem= (IJavaElement) selected[i]; switch (elem.getElementType()) { case IJavaElement.COMPILATION_UNIT: result.add(elem); break; case IJavaElement.IMPORT_CONTAINER: result.add(elem.getParent()); break; case IJavaElement.PACKAGE_FRAGMENT: collectCompilationUnits((IPackageFragment) elem, result); break; case IJavaElement.PACKAGE_FRAGMENT_ROOT: collectCompilationUnits((IPackageFragmentRoot) elem, result); break; case IJavaElement.JAVA_PROJECT: IPackageFragmentRoot[] roots= ((IJavaProject) elem).getPackageFragmentRoots(); for (int k= 0; k < roots.length; k++) { collectCompilationUnits(roots[i], result); } break; } } } catch (JavaModelException e) { JavaPlugin.log(e); } } return (ICompilationUnit[]) result.toArray(new ICompilationUnit[result.size()]); } private void collectCompilationUnits(IPackageFragment pack, Collection result) throws JavaModelException { result.addAll(Arrays.asList(pack.getCompilationUnits())); } private void collectCompilationUnits(IPackageFragmentRoot root, Collection result) throws JavaModelException { if (root.getKind() == IPackageFragmentRoot.K_SOURCE) { IJavaElement[] children= root.getChildren(); for (int i= 0; i < children.length; i++) { collectCompilationUnits((IPackageFragment) children[i], result); } } } private boolean isEnabled(IStructuredSelection selection) { Object[] selected= selection.toArray(); for (int i= 0; i < selected.length; i++) { try { if (selected[i] instanceof IJavaElement) { IJavaElement elem= (IJavaElement) selected[i]; switch (elem.getElementType()) { case IJavaElement.COMPILATION_UNIT: return true; case IJavaElement.IMPORT_CONTAINER: return true; case IJavaElement.PACKAGE_FRAGMENT: IPackageFragment pack= (IPackageFragment) elem; return pack.getCompilationUnits().length > 0; case IJavaElement.PACKAGE_FRAGMENT_ROOT: IPackageFragmentRoot root= (IPackageFragmentRoot) elem; return (root.getKind() == IPackageFragmentRoot.K_SOURCE) && root.hasChildren(); case IJavaElement.JAVA_PROJECT: return hasSourceFolders((IJavaProject) elem); } } } catch (JavaModelException e) { JavaPlugin.log(e); } } return false; } private boolean hasSourceFolders(IJavaProject project) throws JavaModelException { IPackageFragmentRoot[] roots= project.getPackageFragmentRoots(); for (int i= 0; i < roots.length; i++) { IPackageFragmentRoot root= roots[i]; if ((root.getKind() == IPackageFragmentRoot.K_SOURCE) && root.hasChildren()) { return true; } } return false; } /* (non-Javadoc) * Method declared on SelectionDispatchAction. */ protected void run(ITextSelection selection) { IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); ICompilationUnit cu= manager.getWorkingCopy(fEditor.getEditorInput()); runOnSingle(cu, true, true); } /* (non-Javadoc) * Method declared on SelectionDispatchAction. */ protected void run(IStructuredSelection selection) { ICompilationUnit[] cus= getCompilationUnits(selection); if (cus.length == 1) { runOnSingle(cus[0], true, false); } else { runOnMultiple(cus, true); } } private void runOnMultiple(final ICompilationUnit[] cus, final boolean doResolve) { try { String message= ActionMessages.getString("OrganizeImportsAction.multi.status.description"); //$NON-NLS-1$ final MultiStatus status= new MultiStatus(JavaUI.ID_PLUGIN, Status.OK, message, null); ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell()); dialog.run(false, true, new WorkbenchRunnableAdapter(new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) { doRunOnMultiple(cus, status, doResolve, monitor); } })); if (!status.isOK()) { String title= ActionMessages.getString("OrganizeImportsAction.multi.status.title"); //$NON-NLS-1$ ProblemDialog.open(getShell(), title, null, status); } } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.error.message")); //$NON-NLS-1$ //$NON-NLS-2$ } catch (InterruptedException e) { // cancelled by user } } private void doRunOnMultiple(ICompilationUnit[] cus, MultiStatus status, boolean doResolve, IProgressMonitor monitor) throws OperationCanceledException { final class OrganizeImportError extends Error { } if (monitor == null) { monitor= new NullProgressMonitor(); } monitor.beginTask(ActionMessages.getString("OrganizeImportsAction.multi.op.description"), cus.length); //$NON-NLS-1$ try { IPreferenceStore store= PreferenceConstants.getPreferenceStore(); String[] prefOrder= JavaPreferencesSettings.getImportOrderPreference(store); int threshold= JavaPreferencesSettings.getImportNumberThreshold(store); boolean ignoreLowerCaseNames= store.getBoolean(PreferenceConstants.ORGIMPORTS_IGNORELOWERCASE); IChooseImportQuery query= new IChooseImportQuery() { public TypeInfo[] chooseImports(TypeInfo[][] openChoices, ISourceRange[] ranges) { throw new OrganizeImportError(); } }; for (int i= 0; i < cus.length; i++) { ICompilationUnit cu= cus[i]; String cuLocation= cu.getPath().makeRelative().toString(); try { cu= JavaModelUtil.toWorkingCopy(cu); monitor.subTask(cuLocation); OrganizeImportsOperation op= new OrganizeImportsOperation(cu, prefOrder, threshold, ignoreLowerCaseNames, !cu.isWorkingCopy(), doResolve, query); op.run(new SubProgressMonitor(monitor, 1)); if (monitor.isCanceled()) { throw new OperationCanceledException(); } ISourceRange errorRange= op.getErrorSourceRange(); if (errorRange != null) { String message= ActionMessages.getFormattedString("OrganizeImportsAction.multi.error.parse", cuLocation); //$NON-NLS-1$ status.add(new Status(Status.INFO, JavaUI.ID_PLUGIN, Status.ERROR, message, null)); } } catch (OrganizeImportError e) { String message= ActionMessages.getFormattedString("OrganizeImportsAction.multi.error.unresolvable", cuLocation); //$NON-NLS-1$ status.add(new Status(Status.INFO, JavaUI.ID_PLUGIN, Status.ERROR, message, null)); } catch (ValidateEditException e) { status.add(e.getStatus()); } catch (CoreException e) { JavaPlugin.log(e); String message= ActionMessages.getFormattedString("OrganizeImportsAction.multi.error.unexpected", e.getStatus().getMessage()); //$NON-NLS-1$ status.add(new Status(Status.ERROR, JavaUI.ID_PLUGIN, Status.ERROR, message, null)); } } } finally { monitor.done(); } } private void runOnSingle(ICompilationUnit cu, boolean doResolve, boolean inEditor) { if (!ElementValidator.check(cu, getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), inEditor)) //$NON-NLS-1$ return; try { IPreferenceStore store= PreferenceConstants.getPreferenceStore(); String[] prefOrder= JavaPreferencesSettings.getImportOrderPreference(store); int threshold= JavaPreferencesSettings.getImportNumberThreshold(store); boolean ignoreLowerCaseNames= store.getBoolean(PreferenceConstants.ORGIMPORTS_IGNORELOWERCASE); if (!cu.isWorkingCopy()) { IEditorPart editor= EditorUtility.openInEditor(cu); if (editor instanceof JavaEditor) { fEditor= (JavaEditor) editor; } cu= JavaModelUtil.toWorkingCopy(cu); } OrganizeImportsOperation op= new OrganizeImportsOperation(cu, prefOrder, threshold, ignoreLowerCaseNames, !cu.isWorkingCopy(), doResolve, createChooseImportQuery()); BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext(); context.run(false, true, new WorkbenchRunnableAdapter(op)); ISourceRange errorRange= op.getErrorSourceRange(); if (errorRange != null) { MessageDialog.openInformation(getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.single.error.parse")); //$NON-NLS-1$ //$NON-NLS-2$ if (fEditor != null) { fEditor.selectAndReveal(errorRange.getOffset(), errorRange.getLength()); } } else { if (fEditor != null) { setStatusBarMessage(getOrganizeInfo(op)); } } } catch (CoreException e) { ExceptionHandler.handle(e, getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.error.message")); //$NON-NLS-1$ //$NON-NLS-2$ } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.error.message")); //$NON-NLS-1$ //$NON-NLS-2$ } catch (InterruptedException e) { } } private String getOrganizeInfo(OrganizeImportsOperation op) { int nImportsAdded= op.getNumberOfImportsAdded(); if (nImportsAdded >= 0) { return ActionMessages.getFormattedString("OrganizeImportsAction.summary_added", String.valueOf(nImportsAdded)); //$NON-NLS-1$ } else { return ActionMessages.getFormattedString("OrganizeImportsAction.summary_removed", String.valueOf(-nImportsAdded)); //$NON-NLS-1$ } } private IChooseImportQuery createChooseImportQuery() { return new IChooseImportQuery() { public TypeInfo[] chooseImports(TypeInfo[][] openChoices, ISourceRange[] ranges) { return doChooseImports(openChoices, ranges); } }; } private TypeInfo[] doChooseImports(TypeInfo[][] openChoices, final ISourceRange[] ranges) { // remember selection ISelection sel= fEditor.getSelectionProvider().getSelection(); TypeInfo[] result= null;; ILabelProvider labelProvider= new TypeInfoLabelProvider(TypeInfoLabelProvider.SHOW_FULLYQUALIFIED); MultiElementListSelectionDialog dialog= new MultiElementListSelectionDialog(getShell(), labelProvider) { protected void handleSelectionChanged() { super.handleSelectionChanged(); // show choices in editor doListSelectionChanged(getCurrentPage(), ranges); } }; dialog.setTitle(ActionMessages.getString("OrganizeImportsAction.selectiondialog.title")); //$NON-NLS-1$ dialog.setMessage(ActionMessages.getString("OrganizeImportsAction.selectiondialog.message")); //$NON-NLS-1$ dialog.setElements(openChoices); if (dialog.open() == Window.OK) { Object[] res= dialog.getResult(); result= new TypeInfo[res.length]; for (int i= 0; i < res.length; i++) { Object[] array= (Object[]) res[i]; if (array.length > 0) result[i]= (TypeInfo) array[0]; } } // restore selection if (sel instanceof ITextSelection) { ITextSelection textSelection= (ITextSelection) sel; fEditor.selectAndReveal(textSelection.getOffset(), textSelection.getLength()); } return result; } private void doListSelectionChanged(int page, ISourceRange[] ranges) { if (page >= 0 && page < ranges.length) { ISourceRange range= ranges[page]; fEditor.selectAndReveal(range.getOffset(), range.getLength()); } } private void setStatusBarMessage(String message) { IEditorActionBarContributor contributor= fEditor.getEditorSite().getActionBarContributor(); if (contributor instanceof EditorActionBarContributor) { IStatusLineManager manager= ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager(); manager.setMessage(message); } } }
28,354
Bug 28354 Open Type broken: "Could not uniquely map the type name to a type"
Smoke for 20021213 It seems to be broken on per project basis e.g. it works for types in JDT UI but not for types in jdt.ui.tests and jdt.launching.j9. See attached picture for an example.
resolved fixed
835c805
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-16T10:08:05Z
2002-12-16T09:13:20Z
org.eclipse.jdt.ui/core
28,354
Bug 28354 Open Type broken: "Could not uniquely map the type name to a type"
Smoke for 20021213 It seems to be broken on per project basis e.g. it works for types in JDT UI but not for types in jdt.ui.tests and jdt.launching.j9. See attached picture for an example.
resolved fixed
835c805
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-16T10:08:05Z
2002-12-16T09:13:20Z
extension/org/eclipse/jdt/internal/corext/util/TypeInfoFactory.java
28,354
Bug 28354 Open Type broken: "Could not uniquely map the type name to a type"
Smoke for 20021213 It seems to be broken on per project basis e.g. it works for types in JDT UI but not for types in jdt.ui.tests and jdt.launching.j9. See attached picture for an example.
resolved fixed
835c805
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-16T10:08:05Z
2002-12-16T09:13:20Z
org.eclipse.jdt.ui/core
28,354
Bug 28354 Open Type broken: "Could not uniquely map the type name to a type"
Smoke for 20021213 It seems to be broken on per project basis e.g. it works for types in JDT UI but not for types in jdt.ui.tests and jdt.launching.j9. See attached picture for an example.
resolved fixed
835c805
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-16T10:08:05Z
2002-12-16T09:13:20Z
extension/org/eclipse/jdt/internal/corext/util/TypeInfoRequestor.java
28,363
Bug 28363 Navigate>Go to Resource has no effect
JUnit setup 0) activate the package explorer 1) Navigate>Go to>Resource... 2) enter logo.gif 3) OK ->logo gif isn't selected in the package explorer
resolved fixed
99fc3b1
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T13:11:34Z
2002-12-16T12:00:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/GotoResourceAction.java
/******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.internal.ui.packageview; import java.util.ArrayList; import java.util.List; import org.eclipse.jface.action.Action; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.ui.internal.dialogs.ResourceListSelectionDialog; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaModel; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaCore; public class GotoResourceAction extends Action { private PackageExplorerPart fPackageExplorer; private Viewer fViewer; private int fSize; public GotoResourceAction(PackageExplorerPart explorer) { setText(PackagesMessages.getString("GotoResource.action.label")); //$NON-NLS-1$ fPackageExplorer= explorer; fViewer= explorer.getViewer(); fSize= 512; } public void run() { ViewerFilter[] filters= fPackageExplorer.getViewer().getFilters(); List resources= new ArrayList(fSize); try { collect(resources, JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()), filters); } catch (CoreException e) { } IResource resourcesArray[]= (IResource[]) resources.toArray(new IResource[resources.size()]); ResourceListSelectionDialog dialog= new ResourceListSelectionDialog( fPackageExplorer.getViewSite().getShell(), resourcesArray); dialog.setTitle(PackagesMessages.getString("GotoResource.dialog.title")); //$NON-NLS-1$ dialog.open(); Object[] result = dialog.getResult(); if (result == null || result.length == 0 || result[0] instanceof IResource == false) return; IJavaElement selection = JavaCore.create((IResource)result[0]); if (selection != null) fViewer.setSelection(new StructuredSelection(selection), true); } private void collect(List result, IJavaModel parent, ViewerFilter[] filters) throws CoreException { IJavaProject[] projects= parent.getJavaProjects(); for (int i = 0; i < projects.length; i++) { IJavaProject project= projects[i]; if (isVisible(parent, project, filters)) { collect(result, project, filters); } } } private void collect(List result, IJavaProject parent, ViewerFilter[] filters) throws CoreException { boolean handleResources= true; IPackageFragmentRoot[] roots= parent.getPackageFragmentRoots(); for (int i= 0; i < roots.length; i++) { IPackageFragmentRoot root= roots[i]; if (isVisible(parent, root, filters) && !root.isArchive() && !root.isExternal()) { if ("".equals(root.getElementName())) handleResources= false; collect(result, root, filters); } } if (handleResources) handleResources(result, parent, parent.getNonJavaResources(), filters); } private void collect(List result, IPackageFragmentRoot parent, ViewerFilter[] filters) throws CoreException { IJavaElement[] fragments= parent.getChildren(); for (int i= 0; i < fragments.length; i++) { IJavaElement fragment= fragments[i]; if (!isVisible(parent, fragment, filters)) continue; if (fragment.getElementType() == IJavaElement.PACKAGE_FRAGMENT) collect(result, (IPackageFragment)fragment, filters); } handleResources(result, parent, parent.getNonJavaResources(), filters); } private void collect(List result, IPackageFragment parent, ViewerFilter[] filters) throws CoreException { ICompilationUnit[] units= parent.getCompilationUnits(); for (int i= 0; i < units.length; i++) { ICompilationUnit unit= units[i]; if (isVisible(parent, unit, filters)) result.add(unit.getUnderlyingResource()); } handleResources(result, parent, parent.getNonJavaResources(), filters); } private void handleResources(List result, Object parent, Object[] resources, ViewerFilter[] filters) { for (int i= 0; i < resources.length; i++) { Object object= resources[i]; if (isVisible(parent, object, filters) && object instanceof IResource) { result.add(object); } } } private boolean isVisible(Object parent, Object element, ViewerFilter[] filters) { for (int i= 0; i < filters.length; i++) { ViewerFilter filter= filters[i]; if (!filter.select(fViewer, parent, element)) return false; } return true; } }
28,469
Bug 28469 Error ticks appear on empty default package in packages view hierarchical layout
Steps: 1) remove filters in packages view and make sure the layout is hierarchical. make sure default package is visible 2) interduce an error into a cu in a package fragment at depth 2 or 3 in the tree (it actually doesn't matter). Notice that while the tree hierarchy is decorated with error ticks so is the default package though there is not way it should have an errror. 20021216. JRT.
resolved fixed
8ed4c5f
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T14:40:58Z
2002-12-17T10:13:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/TreeHierarchyLayoutProblemsDecorator.java
/******************************************************************************* * Copyright (c) 2000, 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.internal.ui.viewsupport; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.ui.JavaElementImageDescriptor; import org.eclipse.jdt.ui.ProblemsLabelDecorator; import org.eclipse.jdt.internal.ui.browsing.LogicalPackage; /** * Special problem decorator for hierarchical package layout. * <p> * It only decorates package fragments which are not covered by the * <code>ProblemsLabelDecorator</code>. * </p> * * @see org.eclipse.jdt.ui.ProblemsLabelDecorator * @since 2.1 */ public class TreeHierarchyLayoutProblemsDecorator extends ProblemsLabelDecorator { private boolean fIsFlatLayout; public TreeHierarchyLayoutProblemsDecorator() { this(false); } public TreeHierarchyLayoutProblemsDecorator(boolean isFlatLayout) { super(null); fIsFlatLayout= isFlatLayout; } protected int computePackageAdornmentFlags(IPackageFragment fragment) { if (!fIsFlatLayout) { return super.computeAdornmentFlags(fragment.getResource()); } return super.computeAdornmentFlags(fragment); } /* (non-Javadoc) * @see org.eclipse.jdt.ui.ProblemsLabelDecorator#computeAdornmentFlags(java.lang.Object) */ protected int computeAdornmentFlags(Object element) { if (element instanceof IPackageFragment) { return computePackageAdornmentFlags((IPackageFragment) element); } else if (element instanceof LogicalPackage) { IPackageFragment[] fragments= ((LogicalPackage) element).getFragments(); int res= 0; for (int i= 0; i < fragments.length; i++) { int flags= computePackageAdornmentFlags(fragments[i]); if (flags == JavaElementImageDescriptor.ERROR) { return flags; } else if (flags != 0) { res= flags; } } return res; } return super.computeAdornmentFlags(element); } public void setIsFlatLayout(boolean state) { fIsFlatLayout= state; } }
28,442
Bug 28442 NPE in browsing perspective
20021216 i selected the rt.jar java.lang.NullPointerException at org.eclipse.jdt.internal.ui.browsing.PackagesViewLabelProvider.getHierarchicalText(PackagesViewLabelProvider.java:145) at org.eclipse.jdt.internal.ui.browsing.PackagesViewLabelProvider.getText(PackagesViewLabelProvider.java:125) at org.eclipse.jdt.internal.ui.browsing.PackagesViewLabelProvider.getText(PackagesViewLabelProvider.java:114) at org.eclipse.jface.viewers.DecoratingLabelProvider.getText(DecoratingLabelProvider.java:100) at org.eclipse.jdt.internal.ui.browsing.PackagesView$3.getText(PackagesView.java:533) at org.eclipse.jface.viewers.TreeViewer.doUpdateItem(TreeViewer.java:96) at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:363) at org.eclipse.jdt.internal.ui.browsing.PackagesViewTreeViewer.doUpdateItem(PackagesViewTreeViewer.java:127) at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:1132) at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:267) at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:252) at org.eclipse.jface.viewers.AbstractTreeViewer$2.run(AbstractTreeViewer.java:655) at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:684) at org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged(AbstractTreeViewer.java:647) at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:232) at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:871) at org.eclipse.jdt.internal.ui.browsing.PackageViewerWrapper.setViewerInput(PackageViewerWrapper.java:306) at org.eclipse.jdt.internal.ui.browsing.PackagesView.setViewerWrapperInput(PackagesView.java:321) at org.eclipse.jdt.internal.ui.browsing.PackagesView.setInput(PackagesView.java:316) at org.eclipse.jdt.internal.ui.browsing.PackagesView.adjustInputAndSetSelection(PackagesView.java:590) at org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.selectionChanged(JavaBrowsingPart.java:657) at org.eclipse.ui.internal.AbstractSelectionService$4.run(AbstractSelectionService.java:162) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java(Compiled Code)) at org.eclipse.core.runtime.Platform.run(Platform.java(Compiled Code)) at org.eclipse.ui.internal.AbstractSelectionService.firePostSelection(AbstractSelectionService.java:160) at org.eclipse.ui.internal.AbstractSelectionService$2.selectionChanged(AbstractSelectionService.java:60) at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:330) at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:554) at org.eclipse.jface.viewers.StructuredViewer$2.widgetSelected(StructuredViewer.java:572) at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:192) at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:187) at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:327) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java(Compiled Code)) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java(Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java(Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1386) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
resolved fixed
2059ec0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T14:53:31Z
2002-12-17T10:13:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/PackagesViewLabelProvider.java
/******************************************************************************* * Copyright (c) 2000, 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial implementation ******************************************************************************/ package org.eclipse.jdt.internal.ui.browsing; import org.eclipse.swt.graphics.Image; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.Assert; import org.eclipse.jface.viewers.ILabelDecorator; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.viewsupport.AppearanceAwareLabelProvider; import org.eclipse.jdt.internal.ui.viewsupport.ImageDescriptorRegistry; import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; import org.eclipse.jdt.internal.ui.viewsupport.JavaElementLabels; import org.eclipse.jdt.internal.ui.viewsupport.TreeHierarchyLayoutProblemsDecorator; /** * XXX: not yet reviewed - part of experimental logical packages view */ class PackagesViewLabelProvider extends AppearanceAwareLabelProvider { static final int HIERARCHICAL_VIEW_STATE= 0; static final int FLAT_VIEW_STATE= 1; private int fViewState; private ElementImageProvider fElementImageProvider; private ImageDescriptorRegistry fRegistry; private TreeHierarchyLayoutProblemsDecorator fDecorator; PackagesViewLabelProvider(int state) { this(state, AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | JavaElementLabels.P_COMPRESSED, AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS | JavaElementImageProvider.SMALL_ICONS); } PackagesViewLabelProvider(int state, int textFlags, int imageFlags) { super(textFlags, imageFlags); Assert.isTrue(isValidState(state)); fViewState= state; fElementImageProvider= new ElementImageProvider(); fRegistry= JavaPlugin.getImageDescriptorRegistry(); fDecorator= new TreeHierarchyLayoutProblemsDecorator(isFlatView()); addLabelDecorator(fDecorator); } private boolean isValidState(int state) { return state == FLAT_VIEW_STATE || state == HIERARCHICAL_VIEW_STATE; } /* * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) */ public Image getImage(Object element) { if (element instanceof LogicalPackage) { LogicalPackage cp= (LogicalPackage) element; return getLogicalPackageImage(cp); } return super.getImage(element); } /** * Decoration is only concerned with error ticks */ private Image getLogicalPackageImage(LogicalPackage cp) { IPackageFragment[] fragments= cp.getFragments(); for (int i= 0; i < fragments.length; i++) { IPackageFragment fragment= fragments[i]; if(!isEmpty(fragment)) { return decorateCompoundElement(JavaPluginImages.DESC_OBJS_LOGICAL_PACKAGE, cp); } } return decorateCompoundElement(JavaPluginImages.DESC_OBJS_EMPTY_LOGICAL_PACKAGE, cp); } private Image decorateCompoundElement(ImageDescriptor imageDescriptor, LogicalPackage cp) { Image image= fRegistry.get(imageDescriptor); for (int i= 0; i < fLabelDecorators.size(); i++) { ILabelDecorator decorator= (ILabelDecorator) fLabelDecorators.get(i); image= decorator.decorateImage(image, cp); } return image; } private boolean isEmpty(IPackageFragment fragment) { try { return (fragment.getCompilationUnits().length == 0) && (fragment.getClassFiles().length == 0); } catch (JavaModelException e) { JavaPlugin.log(e); } return false; } /* * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) */ public String getText(Object element) { if (element instanceof IPackageFragment) return getText((IPackageFragment)element); else if (element instanceof LogicalPackage) return getText((LogicalPackage)element); else return super.getText(element); } private String getText(IPackageFragment fragment) { if (isFlatView()) return getFlatText(fragment); else return getHierarchicalText(fragment); } private String getText(LogicalPackage logicalPackage) { IPackageFragment[] fragments= logicalPackage.getFragments(); return getText(fragments[0]); } private String getFlatText(IPackageFragment fragment) { return super.getText(fragment); } private boolean isFlatView() { return fViewState==FLAT_VIEW_STATE; } private String getHierarchicalText(IPackageFragment fragment) { if (fragment.isDefaultPackage()) { return super.getText(fragment); } String name= fragment.getResource().getName(); return decorateText(name, fragment); } private String decorateText(String name, Object element) { if (fLabelDecorators == null) return name; for (int i= 0; i < fLabelDecorators.size(); i++) { ILabelDecorator decorator= (ILabelDecorator) fLabelDecorators.get(i); name= decorator.decorateText(name, element); } return name; } private class ElementImageProvider extends JavaElementImageProvider{ public ElementImageProvider() { super(); } public ImageDescriptor getCPImageDescriptor(LogicalPackage element, boolean isEmpty) { if(isEmpty) return JavaPluginImages.DESC_OBJS_EMPTY_LOGICAL_PACKAGE; else return JavaPluginImages.DESC_OBJS_LOGICAL_PACKAGE; } } }
26,723
Bug 26723 [Navigator] Make ResourceListSelectionDialog API
null
resolved fixed
a761eef
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T15:43:59Z
2002-11-19T23:53:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/GotoResourceAction.java
/******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.internal.ui.packageview; import java.util.ArrayList; import java.util.List; import org.eclipse.jface.action.Action; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.ui.internal.dialogs.ResourceListSelectionDialog; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaModel; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaCore; public class GotoResourceAction extends Action { private PackageExplorerPart fPackageExplorer; private Viewer fViewer; private int fSize; public GotoResourceAction(PackageExplorerPart explorer) { setText(PackagesMessages.getString("GotoResource.action.label")); //$NON-NLS-1$ fPackageExplorer= explorer; fViewer= explorer.getViewer(); fSize= 512; } public void run() { ViewerFilter[] filters= fPackageExplorer.getViewer().getFilters(); List resources= new ArrayList(fSize); try { collect(resources, JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()), filters); } catch (CoreException e) { } IResource resourcesArray[]= (IResource[]) resources.toArray(new IResource[resources.size()]); ResourceListSelectionDialog dialog= new ResourceListSelectionDialog( fPackageExplorer.getViewSite().getShell(), resourcesArray); dialog.setTitle(PackagesMessages.getString("GotoResource.dialog.title")); //$NON-NLS-1$ dialog.open(); Object[] result = dialog.getResult(); if (result == null || result.length == 0 || result[0] instanceof IResource == false) return; StructuredSelection selection= null; IJavaElement element = JavaCore.create((IResource)result[0]); if (element != null) selection= new StructuredSelection(element); else selection= new StructuredSelection(result[0]); fViewer.setSelection(selection, true); } private void collect(List result, IJavaModel parent, ViewerFilter[] filters) throws CoreException { IJavaProject[] projects= parent.getJavaProjects(); for (int i = 0; i < projects.length; i++) { IJavaProject project= projects[i]; if (isVisible(parent, project, filters)) { collect(result, project, filters); } } } private void collect(List result, IJavaProject parent, ViewerFilter[] filters) throws CoreException { boolean handleResources= true; IPackageFragmentRoot[] roots= parent.getPackageFragmentRoots(); for (int i= 0; i < roots.length; i++) { IPackageFragmentRoot root= roots[i]; if (isVisible(parent, root, filters) && !root.isArchive() && !root.isExternal()) { if ("".equals(root.getElementName())) handleResources= false; collect(result, root, filters); } } if (handleResources) handleResources(result, parent, parent.getNonJavaResources(), filters); } private void collect(List result, IPackageFragmentRoot parent, ViewerFilter[] filters) throws CoreException { IJavaElement[] fragments= parent.getChildren(); for (int i= 0; i < fragments.length; i++) { IJavaElement fragment= fragments[i]; if (!isVisible(parent, fragment, filters)) continue; if (fragment.getElementType() == IJavaElement.PACKAGE_FRAGMENT) collect(result, (IPackageFragment)fragment, filters); } handleResources(result, parent, parent.getNonJavaResources(), filters); } private void collect(List result, IPackageFragment parent, ViewerFilter[] filters) throws CoreException { ICompilationUnit[] units= parent.getCompilationUnits(); for (int i= 0; i < units.length; i++) { ICompilationUnit unit= units[i]; if (isVisible(parent, unit, filters)) result.add(unit.getUnderlyingResource()); } handleResources(result, parent, parent.getNonJavaResources(), filters); } private void handleResources(List result, Object parent, Object[] resources, ViewerFilter[] filters) { for (int i= 0; i < resources.length; i++) { Object object= resources[i]; if (isVisible(parent, object, filters) && object instanceof IResource) { result.add(object); } } } private boolean isVisible(Object parent, Object element, ViewerFilter[] filters) { for (int i= 0; i < filters.length; i++) { ViewerFilter filter= filters[i]; if (!filter.select(fViewer, parent, element)) return false; } return true; } }
28,439
Bug 28439 java browsing: package view not updated sometimes [browsing]
20021216 maybe it's the desired behavior, i don't know. but it feels strange 1. junit 3.7 with 2 src folders (one has everything and the other some random packages) 2. select the project - stuff is shown in packages view 3. select a package 4. select the project again - nothing happens in the packages view to make anything change you have to click around a couple of times
resolved fixed
cff924a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T17:14:24Z
2002-12-17T10:13:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/ProjectsView.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.ui.browsing; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaModel; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.ui.actions.ProjectActionGroup; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer; public class ProjectsView extends JavaBrowsingPart { /** * Creates the the viewer of this part. * * @param parent the parent for the viewer */ protected StructuredViewer createViewer(Composite parent) { return new ProblemTreeViewer(parent, SWT.MULTI); } /** * Creates the the content provider of this part. */ protected IContentProvider createContentProvider() { return new ProjectAndSourceFolderContentProvider(this); } /** * Returns the context ID for the Help system. * * @return the string used as ID for the Help context */ protected String getHelpContextId() { return IJavaHelpContextIds.PROJECTS_VIEW; } /** * Adds additional listeners to this view. */ protected void hookViewerListeners() { super.hookViewerListeners(); getViewer().addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { TreeViewer viewer= (TreeViewer)getViewer(); Object element= ((IStructuredSelection)event.getSelection()).getFirstElement(); if (viewer.isExpandable(element)) viewer.setExpandedState(element, !viewer.getExpandedState(element)); } }); } protected void setInitialInput() { IJavaElement root= JavaCore.create(JavaPlugin.getWorkspace().getRoot()); getViewer().setInput(root); updateTitle(); } /** * Answers if the given <code>element</code> is a valid * input for this part. * * @param element the object to test * @return <true> if the given element is a valid input */ protected boolean isValidInput(Object element) { return element instanceof IJavaModel; } /** * Answers if the given <code>element</code> is a valid * element for this part. * * @param element the object to test * @return <true> if the given element is a valid element */ protected boolean isValidElement(Object element) { return element instanceof IJavaProject || element instanceof IPackageFragmentRoot; } /** * Finds the element which has to be selected in this part. * * @param je the Java element which has the focus */ protected IJavaElement findElementToSelect(IJavaElement je) { if (je == null) return null; switch (je.getElementType()) { case IJavaElement.JAVA_MODEL : return null; case IJavaElement.JAVA_PROJECT: return je; case IJavaElement.PACKAGE_FRAGMENT_ROOT: if (je.getElementName().equals(IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH)) return je.getParent(); else return je; default : return findElementToSelect(je.getParent()); } } /* * @see JavaBrowsingPart#setInput(Object) */ protected void setInput(Object input) { // Don't allow to clear input for this view if (input != null) super.setInput(input); else getViewer().setSelection(null); } protected void createActions() { super.createActions(); fActionGroups.addGroup(new ProjectActionGroup(this)); } }
28,474
Bug 28474 selection in packages view incorrect when switching editors
use project swt in source for example. 1) open an editor for cu COM in org.eclipse.swt.internal.ole.win32. open an editor for a cu in a different project. 3)make sure browsing view is linked to editor 2)make sure packages view is in hierarchical mode. 3)click in package explorer on project swt. DO NOT expand in packages view. 4)now bring the editor for COM to top. Notice the expansion in the packages view is not complete. Ie. the logical package org.eclipse.swt.internal.ole.win23 is not visible and highlighted. 20021216. JRT.
resolved fixed
d52864d
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T17:15:07Z
2002-12-17T10:13:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/PackagesView.java
/* * (c) Copyright IBM Corp. 2000, 2002. All Rights Reserved. */ package org.eclipse.jdt.internal.ui.browsing; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.util.Assert; import org.eclipse.jface.viewers.DecoratingLabelProvider; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.ILabelDecorator; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IMemento; import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.PartInitException; import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.ui.JavaElementSorter; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.actions.MultiActionGroup; import org.eclipse.jdt.internal.ui.actions.SelectAllAction; import org.eclipse.jdt.internal.ui.filters.NonJavaElementFilter; import org.eclipse.jdt.internal.ui.viewsupport.DecoratingJavaLabelProvider; import org.eclipse.jdt.internal.ui.viewsupport.JavaElementLabels; import org.eclipse.jdt.internal.ui.viewsupport.JavaUILabelProvider; import org.eclipse.jdt.internal.ui.viewsupport.LibraryFilter; import org.eclipse.jdt.internal.ui.viewsupport.ProblemTableViewer; import org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer; import org.eclipse.jdt.internal.ui.viewsupport.StatusBarUpdater; public class PackagesView extends JavaBrowsingPart{ private static final String TAG_VIEW_STATE= ".viewState"; //$NON-NLS-1$ private static final int LIST_VIEW_STATE= 0; private static final int TREE_VIEW_STATE= 1; private static class StatusBarUpdater4LogicalPackage extends StatusBarUpdater { private StatusBarUpdater4LogicalPackage(IStatusLineManager statusLineManager) { super(statusLineManager); } protected String formatMessage(ISelection sel) { if (sel instanceof IStructuredSelection) { IStructuredSelection selection= (IStructuredSelection)sel; int nElements= selection.size(); Object elem= selection.getFirstElement(); if (nElements == 1 && (elem instanceof LogicalPackage)) return formatLogicalPackageMessage((LogicalPackage) elem); } return super.formatMessage(sel); } private String formatLogicalPackageMessage(LogicalPackage logicalPackage) { IPackageFragment[] fragments= logicalPackage.getFragments(); StringBuffer buf= new StringBuffer(logicalPackage.getElementName()); buf.append(JavaElementLabels.CONCAT_STRING); String message= ""; //$NON-NLS-1$ boolean firstTime= true; for (int i= 0; i < fragments.length; i++) { IPackageFragment fragment= fragments[i]; IJavaElement element= fragment.getParent(); if (element instanceof IPackageFragmentRoot) { IPackageFragmentRoot root= (IPackageFragmentRoot) element; String label= JavaElementLabels.getElementLabel(root, JavaElementLabels.DEFAULT_QUALIFIED | JavaElementLabels.ROOT_QUALIFIED); if (firstTime) { buf.append(label); firstTime= false; } else message= JavaBrowsingMessages.getFormattedString("StatusBar.concat", new String[] {message, label}); //$NON-NLS-1$ } } buf.append(message); return buf.toString(); } }; private SelectAllAction fSelectAllAction; private int fCurrViewState; private PackageViewerWrapper fWrappedViewer; private MultiActionGroup fSwitchActionGroup; private IJavaElement fLastInput; private boolean fLastInputWasProject; /** * Adds filters the viewer of this part. */ protected void addFilters() { super.addFilters(); getViewer().addFilter(createNonJavaElementFilter()); getViewer().addFilter(new LibraryFilter()); } /** * Creates new NonJavaElementFilter and overides method select to allow for * LogicalPackages. * @return NonJavaElementFilter */ protected NonJavaElementFilter createNonJavaElementFilter() { return new NonJavaElementFilter(){ public boolean select(Viewer viewer, Object parent, Object element){ return ((element instanceof IJavaElement) || (element instanceof LogicalPackage)); } }; } public void init(IViewSite site, IMemento memento) throws PartInitException { super.init(site, memento); //this must be created before all actions and filters fWrappedViewer= new PackageViewerWrapper(); restoreLayoutState(memento); } private void restoreLayoutState(IMemento memento) { if (memento == null) { //read state from the preference store IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); fCurrViewState= store.getInt(this.getViewSite().getId() + TAG_VIEW_STATE); } else { //restore from memento Integer integer= memento.getInteger(this.getViewSite().getId() + TAG_VIEW_STATE); if ((integer == null) || !isValidState(integer.intValue())) { fCurrViewState= LIST_VIEW_STATE; } else fCurrViewState= integer.intValue(); } } private boolean isValidState(int state) { return (state==LIST_VIEW_STATE) || (state==TREE_VIEW_STATE); } /* * @see org.eclipse.ui.IViewPart#saveState(org.eclipse.ui.IMemento) */ public void saveState(IMemento memento) { super.saveState(memento); memento.putInteger(this.getViewSite().getId()+TAG_VIEW_STATE,fCurrViewState); } /** * Creates the viewer of this part dependent on the current * layout. * * @param parent the parent for the viewer */ protected StructuredViewer createViewer(Composite parent) { StructuredViewer viewer; if(isInListState()) viewer= createTableViewer(parent); else viewer= createTreeViewer(parent); ((PackageViewerWrapper)fWrappedViewer).setViewer(viewer); return fWrappedViewer; } protected boolean isInListState() { return fCurrViewState== LIST_VIEW_STATE; } private ProblemTableViewer createTableViewer(Composite parent) { return new PackagesViewTableViewer(parent, SWT.MULTI); } private ProblemTreeViewer createTreeViewer(Composite parent) { return new PackagesViewTreeViewer(parent, SWT.MULTI); } /** * Overrides the createContentProvider from JavaBrowsingPart * Creates the the content provider of this part. */ protected IContentProvider createContentProvider() { if(isInListState()) return new PackagesViewFlatContentProvider(fWrappedViewer.getViewer()); else return new PackagesViewHierarchicalContentProvider(fWrappedViewer.getViewer()); } protected JavaUILabelProvider createLabelProvider() { if(isInListState()) return createListLabelProvider(); else return createTreeLabelProvider(); } private JavaUILabelProvider createTreeLabelProvider() { return new PackagesViewLabelProvider(PackagesViewLabelProvider.HIERARCHICAL_VIEW_STATE); } private JavaUILabelProvider createListLabelProvider() { return new PackagesViewLabelProvider(PackagesViewLabelProvider.FLAT_VIEW_STATE); } private ILabelDecorator[] concat(ILabelDecorator[] d1, ILabelDecorator[] d2) { int d1Len= d1.length; int d2Len= d2.length; ILabelDecorator[] decorators= new ILabelDecorator[d1Len + d2Len]; System.arraycopy(d1, 0, decorators, 0, d1Len); System.arraycopy(d2, 0, decorators, d1Len, d2Len); return decorators; } /** * Returns the context ID for the Help system * * @return the string used as ID for the Help context */ protected String getHelpContextId() { return IJavaHelpContextIds.PACKAGES_BROWSING_VIEW; } /** * Answers if the given <code>element</code> is a valid * input for this part. * * @param element the object to test * @return <true> if the given element is a valid input */ protected boolean isValidInput(Object element) { if (element instanceof IJavaProject || (element instanceof IPackageFragmentRoot && ((IJavaElement)element).getElementName() != IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH)) try { IJavaProject jProject= ((IJavaElement)element).getJavaProject(); if (jProject != null) return jProject.getProject().hasNature(JavaCore.NATURE_ID); } catch (CoreException ex) { return false; } return false; } /** * Answers if the given <code>element</code> is a valid * element for this part. * * @param element the object to test * @return <true> if the given element is a valid element */ protected boolean isValidElement(Object element) { if (element instanceof IPackageFragment) { IJavaElement parent= ((IPackageFragment)element).getParent(); if (parent != null) return super.isValidElement(parent) || super.isValidElement(parent.getJavaProject()); } return false; } /** * Finds the element which has to be selected in this part. * * @param je the Java element which has the focus */ protected IJavaElement findElementToSelect(IJavaElement je) { if (je == null) return null; switch (je.getElementType()) { case IJavaElement.PACKAGE_FRAGMENT: return je; case IJavaElement.COMPILATION_UNIT: return ((ICompilationUnit)je).getParent(); case IJavaElement.CLASS_FILE: return ((IClassFile)je).getParent(); case IJavaElement.TYPE: return ((IType)je).getPackageFragment(); default: return findElementToSelect(je.getParent()); } } /* * @see org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart#setInput(java.lang.Object) */ protected void setInput(Object input) { setViewerWrapperInput(input); super.updateTitle(); } private void setViewerWrapperInput(Object input) { fWrappedViewer.setViewerInput(input); } /** * @see org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart#fillActionBars(org.eclipse.ui.IActionBars) */ protected void fillActionBars(IActionBars actionBars) { super.fillActionBars(actionBars); fSwitchActionGroup.fillActionBars(actionBars); } private void setUpViewer(StructuredViewer viewer){ Assert.isTrue(viewer != null); JavaUILabelProvider labelProvider= createLabelProvider(); viewer.setLabelProvider(createDecoratingLabelProvider(labelProvider)); viewer.setSorter(createJavaElementSorter()); viewer.setUseHashlookup(true); createContextMenu(); //disapears when control disposed addKeyListener(); //this methods only adds listeners to the viewer, //these listenters disapear when the viewer is disposed hookViewerListeners(); // Set content provider viewer.setContentProvider(createContentProvider()); //Disposed when viewer's Control is disposed initDragAndDrop(); } //alter sorter to include LogicalPackages protected JavaElementSorter createJavaElementSorter() { return new JavaElementSorter(){ public int category(Object element) { if (element instanceof LogicalPackage) { LogicalPackage cp= (LogicalPackage) element; return super.category(cp.getFragments()[0]); } else return super.category(element); } public int compare(Viewer viewer, Object e1, Object e2){ if (e1 instanceof LogicalPackage) { LogicalPackage cp= (LogicalPackage) e1; e1= cp.getFragments()[0]; } if (e2 instanceof LogicalPackage) { LogicalPackage cp= (LogicalPackage) e2; e2= cp.getFragments()[0]; } return super.compare(viewer, e1, e2); } }; } protected StatusBarUpdater createStatusBarUpdater(IStatusLineManager slManager) { return new StatusBarUpdater4LogicalPackage(slManager); } protected void setSiteSelectionProvider(){ getSite().setSelectionProvider(fWrappedViewer); } //do the same thing as the JavaBrowsingPart but with wrapper protected void createActions() { super.createActions(); createSelectAllAction(); //create the switch action group fSwitchActionGroup= createSwitchActionGroup(); } private MultiActionGroup createSwitchActionGroup(){ LayoutAction switchToFlatViewAction= new LayoutAction(JavaBrowsingMessages.getString("PackagesView.flatLayoutAction.label"),LIST_VIEW_STATE); //$NON-NLS-1$ LayoutAction switchToHierarchicalViewAction= new LayoutAction(JavaBrowsingMessages.getString("PackagesView.HierarchicalLayoutAction.label"), TREE_VIEW_STATE); //$NON-NLS-1$ JavaPluginImages.setLocalImageDescriptors(switchToFlatViewAction, "flatLayout.gif"); //$NON-NLS-1$ JavaPluginImages.setLocalImageDescriptors(switchToHierarchicalViewAction, "hierarchicalLayout.gif"); //$NON-NLS-1$ return new LayoutActionGroup(new IAction[]{switchToFlatViewAction,switchToHierarchicalViewAction}, fCurrViewState); } private static class LayoutActionGroup extends MultiActionGroup { LayoutActionGroup(IAction[] actions, int index) { super(actions, index); } public void fillActionBars(IActionBars actionBars) { //create new layout group IMenuManager manager= actionBars.getMenuManager(); IContributionItem groupMarker= new GroupMarker("Layout"); //$NON-NLS-1$ manager.add(groupMarker); IMenuManager newManager= new MenuManager(JavaBrowsingMessages.getString("PackagesView.LayoutActionGroup.layout.label")); //$NON-NLS-1$ manager.appendToGroup("Layout", newManager); //$NON-NLS-1$ super.addActions(newManager); } } /** * Switches between flat and hierarchical state. */ private class LayoutAction extends Action { private int fState; private Runnable fRunnable; public LayoutAction(String text, int state) { super(text); fState= state; } public int getState() { return fState; } public void setRunnable(Runnable runnable) { Assert.isNotNull(runnable); fRunnable= runnable; } /* * @see org.eclipse.jface.action.IAction#run() */ public void run() { switchViewer(fState); } } private void switchViewer(int state) { //Indicate which viewer is to be used if (fCurrViewState == state) return; else { fCurrViewState= state; IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); store.setValue(getViewSite().getId() + TAG_VIEW_STATE, state); } //get the information from the existing viewer StructuredViewer viewer= fWrappedViewer.getViewer(); Object object= viewer.getInput(); ISelection selection= viewer.getSelection(); // create and set up the new viewer Control control= createViewer(fWrappedViewer.getControl().getParent()).getControl(); setUpViewer(fWrappedViewer); createSelectAllAction(); // add the selection information from old viewer fWrappedViewer.setViewerInput(object); fWrappedViewer.setSelection(selection, true); // dispose old viewer viewer.getContentProvider().dispose(); viewer.getControl().dispose(); // layout the new viewer if (control != null && !control.isDisposed()) { control.setVisible(true); control.getParent().layout(true); } } private void createSelectAllAction() { IActionBars actionBars= getViewSite().getActionBars(); if (isInListState()) { fSelectAllAction= new SelectAllAction((TableViewer)fWrappedViewer.getViewer()); actionBars.setGlobalActionHandler(IWorkbenchActionConstants.SELECT_ALL, fSelectAllAction); } else { actionBars.setGlobalActionHandler(IWorkbenchActionConstants.SELECT_ALL, null); fSelectAllAction= null; } actionBars.updateActionBars(); } /* * @see org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart#findInputForJavaElement(org.eclipse.jdt.core.IJavaElement) */ protected IJavaElement findInputForJavaElement(IJavaElement je) { if (isValidInput(je)){ fLastInputWasProject= je.getElementType() == IJavaElement.JAVA_PROJECT; return je; } else if (fLastInputWasProject && je != null) { return je.getJavaProject(); } else return super.findInputForJavaElement(je); } /** * Override the getText and getImage methods for the DecoratingLabelProvider * to handel the decoration of logical packages. * * @see org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart#createDecoratingLabelProvider(org.eclipse.jface.viewers.ILabelDecorator) */ protected DecoratingLabelProvider createDecoratingLabelProvider(JavaUILabelProvider provider) { return new DecoratingJavaLabelProvider(provider, false, false) { public String getText(Object element){ if (element instanceof LogicalPackage) { LogicalPackage el= (LogicalPackage) element; return super.getText(el.getFragments()[0]); } else return super.getText(element); } public Image getImage(Object element) { if(element instanceof LogicalPackage){ LogicalPackage el= (LogicalPackage) element; ILabelDecorator decorator= getLabelDecorator(); IPackageFragment[] fragments= el.getFragments(); Image image= super.getImage(el); for (int i= 0; i < fragments.length; i++) { IPackageFragment fragment= fragments[i]; Image decoratedImage= decorator.decorateImage(image, fragment); if(decoratedImage != null) image= decoratedImage; } return image; } else return super.getImage(element); } }; } /* * Overridden from JavaBrowsingPart to handel LogicalPackages and tree * structure. * @see org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart#adjustInputAndSetSelection(org.eclipse.jdt.core.IJavaElement) */ void adjustInputAndSetSelection(IJavaElement je) { IJavaElement jElementToSelect= getSuitableJavaElement(findElementToSelect(je)); LogicalPackagesProvider p= (LogicalPackagesProvider) fWrappedViewer.getContentProvider(); Object elementToSelect= jElementToSelect; if (jElementToSelect != null && jElementToSelect.getElementType() == IJavaElement.PACKAGE_FRAGMENT) { IPackageFragment pkgFragment= (IPackageFragment)jElementToSelect; elementToSelect= p.findLogicalPackage(pkgFragment); if (elementToSelect == null) elementToSelect= pkgFragment; } IJavaElement newInput= findInputForJavaElement(je); if (elementToSelect == null && !isValidInput(newInput)) setInput(null); else if (elementToSelect == null || getViewer().testFindItem(elementToSelect) == null) { //optimization, if you are in the same project but expansion hasn't happened Object input= getViewer().getInput(); if (elementToSelect != null && newInput != null) { if (newInput.equals(input)) { getViewer().reveal(elementToSelect); // Adjust input to selection } else { setInput(newInput); getViewer().reveal(elementToSelect); } } else setInput(newInput); // Recompute suitable element since it depends on the viewer's input jElementToSelect= getSuitableJavaElement(elementToSelect); if (jElementToSelect != null && jElementToSelect.getElementType() == IJavaElement.PACKAGE_FRAGMENT) { IPackageFragment pkgFragment= (IPackageFragment)jElementToSelect; elementToSelect= p.findLogicalPackage(pkgFragment); if (elementToSelect == null) elementToSelect= pkgFragment; } } ISelection selection; if (elementToSelect != null) selection= new StructuredSelection(elementToSelect); else selection= StructuredSelection.EMPTY; setSelection(selection, true); } }
28,474
Bug 28474 selection in packages view incorrect when switching editors
use project swt in source for example. 1) open an editor for cu COM in org.eclipse.swt.internal.ole.win32. open an editor for a cu in a different project. 3)make sure browsing view is linked to editor 2)make sure packages view is in hierarchical mode. 3)click in package explorer on project swt. DO NOT expand in packages view. 4)now bring the editor for COM to top. Notice the expansion in the packages view is not complete. Ie. the logical package org.eclipse.swt.internal.ole.win23 is not visible and highlighted. 20021216. JRT.
resolved fixed
d52864d
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T17:15:07Z
2002-12-17T10:13:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/PackagesViewHierarchicalContentProvider.java
/******************************************************************************* * Copyright (c) 2000, 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial implementation ******************************************************************************/ package org.eclipse.jdt.internal.ui.browsing; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElementDelta; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.eclipse.jdt.internal.ui.JavaPlugin; /** * * XXX: not yet reviewed - part of experimental logical packages view * * Tree content provider for the hierarchical layout in the packages view. * <p> * XXX: The standard Java browsing part content provider needs and calls * the browsing part/view. This class currently doesn't need to do so * but might be required to later. * </p> */ class PackagesViewHierarchicalContentProvider extends LogicalPackagesProvider implements ITreeContentProvider { public PackagesViewHierarchicalContentProvider(StructuredViewer viewer){ super(viewer); } /* * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object) */ public Object[] getChildren(Object parentElement) { try { if (parentElement instanceof IJavaElement) { IJavaElement iJavaElement= (IJavaElement) parentElement; int type= iJavaElement.getElementType(); switch (type) { case IJavaElement.JAVA_PROJECT : { //create new element mapping fMapToLogicalPackage.clear(); fMapToPackageFragments.clear(); IJavaProject project= (IJavaProject) parentElement; IPackageFragment[] topLevelChildren= getTopLevelChildrenByElementName(project.getPackageFragments()); List list= new ArrayList(); for (int i= 0; i < topLevelChildren.length; i++) { IPackageFragment fragment= topLevelChildren[i]; IJavaElement el= fragment.getParent(); if (el instanceof IPackageFragmentRoot) { IPackageFragmentRoot root= (IPackageFragmentRoot) el; if (!root.isArchive() || !root.isExternal()) list.add(fragment); } } return combineSamePackagesIntoLogialPackages((IPackageFragment[]) list.toArray(new IPackageFragment[list.size()])); } case IJavaElement.PACKAGE_FRAGMENT_ROOT : { IPackageFragmentRoot root= (IPackageFragmentRoot) parentElement; //create new element mapping fMapToLogicalPackage.clear(); fMapToPackageFragments.clear(); IResource resource= root.getUnderlyingResource(); IPackageFragment[] fragments= new IPackageFragment[0]; if (root.isArchive()) { IJavaElement[] els= root.getChildren(); fragments= getTopLevelChildrenByElementName(els); } else if (resource != null && resource instanceof IFolder) { fragments= getTopLevelChildrenByElementName(root.getChildren()); } addFragmentsToMap(fragments); return fragments; } case IJavaElement.PACKAGE_FRAGMENT : { IPackageFragment packageFragment= (IPackageFragment) parentElement; IPackageFragment[] fragments= new IPackageFragment[0]; IJavaElement parent= packageFragment.getParent(); if (parent instanceof IPackageFragmentRoot) { IPackageFragmentRoot root= (IPackageFragmentRoot) parent; fragments= findNextLevelChildrenByElementName(root, packageFragment); } addFragmentsToMap(fragments); return fragments; } } //@Improve: rewrite using concatenate } else if (parentElement instanceof LogicalPackage) { List children= new ArrayList(); LogicalPackage logicalPackage= (LogicalPackage) parentElement; IPackageFragment[] elements= logicalPackage.getFragments(); for (int i= 0; i < elements.length; i++) { IPackageFragment fragment= elements[i]; IPackageFragment[] objects= findNextLevelChildrenByElementName((IPackageFragmentRoot) fragment.getParent(), fragment); children.addAll(Arrays.asList(objects)); } return combineSamePackagesIntoLogialPackages((IPackageFragment[]) children.toArray(new IPackageFragment[children.size()])); } } catch (JavaModelException e) { JavaPlugin.log(e); } return new Object[0]; } private IPackageFragment[] findNextLevelChildrenByElementName(IPackageFragmentRoot parent, IPackageFragment fragment) { List list= new ArrayList(); try { IJavaElement[] children= parent.getChildren(); String fragmentname= fragment.getElementName(); for (int i= 0; i < children.length; i++) { IJavaElement element= children[i]; if (element instanceof IPackageFragment) { IPackageFragment frag= (IPackageFragment) element; String name= element.getElementName(); if (frag.exists() && !IPackageFragment.DEFAULT_PACKAGE_NAME.equals(fragmentname) && name.startsWith(fragmentname) && !name.equals(fragmentname)) { String tail= name.substring(fragmentname.length() + 1); if (!IPackageFragment.DEFAULT_PACKAGE_NAME.equals(tail) && (tail.indexOf(".") == -1)) { //$NON-NLS-1$ list.add(frag); } } } } } catch (JavaModelException e) { JavaPlugin.log(e); } return (IPackageFragment[]) list.toArray(new IPackageFragment[list.size()]); } private IPackageFragment[] getTopLevelChildrenByElementName(IJavaElement[] elements){ List topLevelElements= new ArrayList(); for (int i= 0; i < elements.length; i++) { IJavaElement iJavaElement= elements[i]; //if the name of the PackageFragment is the top level package it will contain no "." separators if((iJavaElement.getElementName().indexOf(".")==-1) && (iJavaElement instanceof IPackageFragment)){ //$NON-NLS-1$ topLevelElements.add(iJavaElement); } } return (IPackageFragment[]) topLevelElements.toArray(new IPackageFragment[topLevelElements.size()]); } /* * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object) */ public Object getParent(Object element) { try { if (element instanceof IPackageFragment) { IPackageFragment fragment= (IPackageFragment) element; if(!fragment.exists()) return null; Object parent= getHierarchicalParent(fragment); if(parent instanceof IPackageFragment) { IPackageFragment pkgFragment= (IPackageFragment)parent; LogicalPackage logicalPkg= findLogicalPackage(pkgFragment); if (logicalPkg != null) return logicalPkg; else return pkgFragment; } return parent; } else if(element instanceof LogicalPackage){ LogicalPackage el= (LogicalPackage) element; IPackageFragment fragment= el.getFragments()[0]; Object parent= getHierarchicalParent(fragment); if(parent instanceof IPackageFragment){ IPackageFragment pkgFragment= (IPackageFragment) parent; LogicalPackage logicalPkg= findLogicalPackage(pkgFragment); if (logicalPkg != null) return logicalPkg; else return pkgFragment; } else return fragment.getJavaProject(); } } catch (JavaModelException e) { JavaPlugin.log(e); } return null; } private Object getHierarchicalParent(IPackageFragment fragment) throws JavaModelException { IJavaElement parent= fragment.getParent(); if ((parent instanceof IPackageFragmentRoot) && parent.exists()) { IPackageFragmentRoot root= (IPackageFragmentRoot) parent; if (root.isArchive() || !fragment.exists()) { return findNextLevelParentByElementName(fragment, root); } else { IResource resource= fragment.getUnderlyingResource(); if ((resource != null) && (resource instanceof IFolder)) { IFolder folder= (IFolder) resource; IResource res= folder.getParent(); IJavaElement el= JavaCore.create(res); return el; } } } return parent; } private Object findNextLevelParentByElementName(IJavaElement child, IJavaElement parent) { String name= child.getElementName(); if(name.indexOf(".")==-1) //$NON-NLS-1$ return parent; try { String realParentName= child.getElementName().substring(0,name.lastIndexOf(".")); //$NON-NLS-1$ IJavaElement[] children= new IJavaElement[0]; if(parent instanceof IPackageFragmentRoot){ IPackageFragmentRoot root= (IPackageFragmentRoot) parent; children= root.getChildren(); } else if(parent instanceof IJavaProject){ IJavaProject project= (IJavaProject) parent; children= project.getPackageFragments(); } for (int i= 0; i < children.length; i++) { IJavaElement element= children[i]; if(element.getElementName().equals(realParentName)) return element; } } catch (JavaModelException e) { JavaPlugin.log(e); } return parent; } /* * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object) */ public boolean hasChildren(Object element) { if (element instanceof IPackageFragment) { IPackageFragment fragment= (IPackageFragment) element; if(fragment.isDefaultPackage() || !fragment.exists()) return false; } return getChildren(element).length > 0; } /* * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object) */ public Object[] getElements(Object inputElement) { return getChildren(inputElement); } protected void processDelta(IJavaElementDelta delta) throws JavaModelException { int kind = delta.getKind(); final IJavaElement element = delta.getElement(); if (element instanceof IPackageFragment) { final IPackageFragment frag = (IPackageFragment) element; //if fragment was in LogicalPackage refresh, //otherwise just remove if (kind == IJavaElementDelta.REMOVED) { removeElement(frag); return; } else if (kind == IJavaElementDelta.ADDED) { Object parent= getParent(frag); addElement(frag, parent); return; } else if (kind == IJavaElementDelta.CHANGED) { //just refresh LogicalPackage logicalPkg= findLogicalPackage(frag); //in case changed object is filtered out if (logicalPkg != null) postRefresh(findElementToRefresh(logicalPkg)); else postRefresh(findElementToRefresh(frag)); return; } } processAffectedChildren(delta); } private Object findElementToRefresh(Object object) { Object toBeRefreshed= object; if (fViewer.testFindItem(object) == null) { Object parent= getParent(object); if(parent instanceof IPackageFragmentRoot && fInputIsProject) parent= ((IPackageFragmentRoot)parent).getJavaProject(); if(parent != null) toBeRefreshed= parent; } return toBeRefreshed; } private void processAffectedChildren(IJavaElementDelta delta) throws JavaModelException { IJavaElementDelta[] affectedChildren = delta.getAffectedChildren(); for (int i = 0; i < affectedChildren.length; i++) { if (!(affectedChildren[i] instanceof ICompilationUnit)) { processDelta(affectedChildren[i]); } } } private void postAdd(final Object child, final Object parent) { postRunnable(new Runnable() { public void run() { Control ctrl = fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { ((TreeViewer)fViewer).add(parent, child); } } }); } private void postRemove(final Object object) { postRunnable(new Runnable() { public void run() { Control ctrl = fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { ((TreeViewer)fViewer).remove(object); } } }); } private void postRefresh(final Object object) { postRunnable(new Runnable() { public void run() { Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { ((TreeViewer) fViewer).refresh(object); } } }); } private void postRunnable(final Runnable r) { Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { // fBrowsingPart.setProcessSelectionEvents(false); try { Display currentDisplay= Display.getCurrent(); if (currentDisplay != null && currentDisplay.equals(ctrl.getDisplay())) ctrl.getDisplay().syncExec(r); else ctrl.getDisplay().asyncExec(r); } finally { // fBrowsingPart.setProcessSelectionEvents(true); } } } private void addElement(IPackageFragment frag, Object parent) { String key= getKey(frag); LogicalPackage lp= (LogicalPackage)fMapToLogicalPackage.get(key); //if fragment must be added to an existing LogicalPackage if (lp != null && lp.belongs(frag)){ lp.add(frag); return; } //if a new LogicalPackage must be created IPackageFragment iPackageFragment= (IPackageFragment)fMapToPackageFragments.get(key); if (iPackageFragment!= null && !iPackageFragment.equals(frag)){ lp= new LogicalPackage(iPackageFragment); lp.add(frag); //add new LogicalPackage to LogicalPackages map fMapToLogicalPackage.put(key, lp); //determin who to refresh if (parent instanceof IPackageFragmentRoot){ IPackageFragmentRoot root= (IPackageFragmentRoot) parent; if (fInputIsProject){ postRefresh(root.getJavaProject()); } else { postRefresh(root); } } else { //@Improve: Shoud this be replaced by a refresh? postAdd(lp, parent); postRemove(iPackageFragment); } } //if this is a new Package Fragment else { fMapToPackageFragments.put(key, frag); //determin who to refresh if (parent instanceof IPackageFragmentRoot) { IPackageFragmentRoot root= (IPackageFragmentRoot) parent; if (fInputIsProject) { postAdd(frag, root.getJavaProject()); } else postAdd(frag, root); } else { postAdd(frag, parent); } } } private void removeElement(IPackageFragment frag) { String key= getKey(frag); LogicalPackage lp= (LogicalPackage)fMapToLogicalPackage.get(key); if(lp != null){ lp.remove(frag); //if the LogicalPackage needs to revert back to a PackageFragment //remove it from the LogicalPackages map and add the PackageFragment //to the PackageFragment map if (lp.getFragments().length == 1) { IPackageFragment fragment= lp.getFragments()[0]; fMapToPackageFragments.put(key, fragment); fMapToLogicalPackage.remove(key); //remove the LogicalPackage frome viewer postRemove(lp); Object parent= getParent(fragment); if (parent instanceof IPackageFragmentRoot) { parent= ((IPackageFragmentRoot)parent).getJavaProject(); } postAdd(fragment, parent); } } else { //remove the fragment from the fragment map and viewer IPackageFragment fragment= (IPackageFragment) fMapToPackageFragments.get(key); if (fragment!= null && fragment.equals(frag)) { fMapToPackageFragments.remove(key); postRemove(frag); } } } }
28,457
Bug 28457 UI for refactoring 'pull up...' must be [a bit] larger [refactoring]
Steps: Setup: 1) in junit.awtui.Logo create a bogus super class that extends Canvas (call it XCanvas). 2) Extract the line: URL url= BaseTestRunner.class.getResource(nameOfStrings); from method loadImage into its own method called getURL. 3)Choose to refactor->Pull Up Notice that in the preview dialog the 'source of type' and 'subtype of type' boxes have only one line [or tree node] visible making very difficult to understand what the refactoring. They should be larger so I can gleen what is going on. 20021216. JRT.
resolved fixed
1b5f7c9
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T17:47:43Z
2002-12-17T10:13:20Z
org.eclipse.jdt.ui/ui
28,457
Bug 28457 UI for refactoring 'pull up...' must be [a bit] larger [refactoring]
Steps: Setup: 1) in junit.awtui.Logo create a bogus super class that extends Canvas (call it XCanvas). 2) Extract the line: URL url= BaseTestRunner.class.getResource(nameOfStrings); from method loadImage into its own method called getURL. 3)Choose to refactor->Pull Up Notice that in the preview dialog the 'source of type' and 'subtype of type' boxes have only one line [or tree node] visible making very difficult to understand what the refactoring. They should be larger so I can gleen what is going on. 20021216. JRT.
resolved fixed
1b5f7c9
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T17:47:43Z
2002-12-17T10:13:20Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/PullUpInputPage.java
28,547
Bug 28547 Automatic detection of source folders doesn't work
Build 20021216 1. Create folder d:\temp\test\src\p 2. Create file X.java in d:\temp\test\src\p: package p; public class X { } 3. In a fresh workspace, create new Java project 4. Uncheck use default project contents, and point to d:\temp\test 5. Press Finish Observe: You get an error dialog saying that src/P [in Test] does not exist. The problem is that the NewProjectWizard is visiting the tree before it adds the Java nature to the project. It then asks the compilation unit /Test/src/p/X.java for its package declaration. This throws a JavaModeException since the project is not a Java project.
resolved fixed
fcb0b9b
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T18:11:52Z
2002-12-17T18:33:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewProjectCreationWizardPage.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.ui.wizards; import java.lang.reflect.InvocationTargetException; import java.util.HashSet; import java.util.Iterator; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceVisitor; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageDeclaration; import org.eclipse.jdt.core.JavaConventions; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; import org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock; /** * As addition to the JavaCapabilityConfigurationPage, the wizard checks if an existing external * location was specified and offers to do an early project creation so that classpath can be detected. */ public class NewProjectCreationWizardPage extends JavaCapabilityConfigurationPage { private WizardNewProjectCreationPage fMainPage; private IPath fCurrProjectLocation; private boolean fProjectCreated; /** * Constructor for ProjectWizardPage. */ public NewProjectCreationWizardPage(WizardNewProjectCreationPage mainPage) { super(); fMainPage= mainPage; fCurrProjectLocation= fMainPage.getLocationPath(); fProjectCreated= false; } private boolean canDetectExistingClassPath(IPath projLocation) { return projLocation.toFile().exists() && !Platform.getLocation().equals(projLocation); } private void update() { IPath projLocation= fMainPage.getLocationPath(); if (!projLocation.equals(fCurrProjectLocation) && canDetectExistingClassPath(projLocation)) { String title= NewWizardMessages.getString("NewProjectCreationWizardPage.EarlyCreationDialog.title"); //$NON-NLS-1$ String description= NewWizardMessages.getString("NewProjectCreationWizardPage.EarlyCreationDialog.description"); //$NON-NLS-1$ if (MessageDialog.openQuestion(getShell(), title, description)) { createAndDetect(); } } fCurrProjectLocation= projLocation; IJavaProject prevProject= getJavaProject(); IProject currProject= fMainPage.getProjectHandle(); if ((prevProject == null) || !currProject.equals(prevProject.getProject())) { init(JavaCore.create(currProject), null, null, false); } } private void createAndDetect() { IRunnableWithProgress op= new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (monitor == null) monitor= new NullProgressMonitor(); monitor.beginTask(NewWizardMessages.getString("NewProjectCreationWizardPage.EarlyCreationOperation.desc"), 3); //$NON-NLS-1$ try { BuildPathsBlock.createProject(fMainPage.getProjectHandle(), fMainPage.getLocationPath(), new SubProgressMonitor(monitor, 1)); fProjectCreated= true; initFromExistingStructures(new SubProgressMonitor(monitor, 2)); } catch (CoreException e) { throw new InvocationTargetException(e); } } }; try { getContainer().run(false, true, op); } catch (InvocationTargetException e) { String title= NewWizardMessages.getString("NewProjectCreationWizardPage.EarlyCreationOperation.error.title"); //$NON-NLS-1$ String message= NewWizardMessages.getString("NewProjectCreationWizardPage.EarlyCreationOperation.error.desc"); //$NON-NLS-1$ ExceptionHandler.handle(e, getShell(), title, message); } catch (InterruptedException e) { // cancel pressed } } /* (non-Javadoc) * @see IDialogPage#setVisible(boolean) */ public void setVisible(boolean visible) { if (visible) { update(); } super.setVisible(visible); } /* (non-Javadoc) * @see IWizardPage#getPreviousPage() */ public IWizardPage getPreviousPage() { if (fProjectCreated) { return null; } return super.getPreviousPage(); } public void createProject(IProgressMonitor monitor) throws CoreException, InterruptedException { if (monitor == null) { monitor= new NullProgressMonitor(); } try { monitor.beginTask(NewWizardMessages.getString("NewProjectCreationWizardPage.NormalCreationOperation.desc"), 4); //$NON-NLS-1$ BuildPathsBlock.createProject(fMainPage.getProjectHandle(), fMainPage.getLocationPath(), new SubProgressMonitor(monitor, 1)); if (getJavaProject() == null) { initFromExistingStructures(new SubProgressMonitor(monitor, 1)); } else { monitor.worked(1); } configureJavaProject(new SubProgressMonitor(monitor, 2)); } finally { monitor.done(); } } private void initFromExistingStructures(IProgressMonitor monitor) throws CoreException { monitor.beginTask(NewWizardMessages.getString("NewProjectCreationWizardPage.DetectingClasspathOperation.desc"), 2); //$NON-NLS-1$ try { IProject project= fMainPage.getProjectHandle(); if (project.getFile(".classpath").exists()) { //$NON-NLS-1$ init(JavaCore.create(project), null, null, false); monitor.worked(2); } else{ final HashSet sourceFolders= new HashSet(); IResourceVisitor visitor= new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { return doVisit(resource, sourceFolders); } }; project.accept(visitor); monitor.worked(1); IClasspathEntry[] entries= null; IPath outputLocation= null; if (!sourceFolders.isEmpty()) { int nSourceFolders= sourceFolders.size(); IClasspathEntry[] jreEntries= PreferenceConstants.getDefaultJRELibrary(); entries= new IClasspathEntry[nSourceFolders + jreEntries.length]; Iterator iter = sourceFolders.iterator(); for (int i = 0; i < nSourceFolders; i++) { entries[i]= JavaCore.newSourceEntry((IPath) iter.next()); } System.arraycopy(jreEntries, 0, entries, nSourceFolders, jreEntries.length); IPath projPath= project.getFullPath(); if (nSourceFolders == 1 && entries[0].getPath().equals(projPath)) { outputLocation= projPath; } else { outputLocation= projPath.append(PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.SRCBIN_BINNAME)); } if (!JavaConventions.validateClasspath(JavaCore.create(project), entries, outputLocation).isOK()) { outputLocation= null; entries= null; } } init(JavaCore.create(project), outputLocation, entries, false); monitor.worked(1); } } finally { monitor.done(); } } private boolean doVisit(IResource resource, HashSet sourceFolders) throws JavaModelException { if (!sourceFolders.isEmpty()) { IResource curr= resource; while (curr.getType() != IResource.ROOT) { if (sourceFolders.contains(curr.getFullPath())) { return false; } curr= curr.getParent(); } } if (resource.getType() == IResource.FILE) { if ("java".equals(resource.getFileExtension())) { //$NON-NLS-1$ ICompilationUnit cu= JavaCore.createCompilationUnitFrom((IFile) resource); if (cu != null) { IPath packPath= resource.getParent().getFullPath(); IPackageDeclaration[] decls= cu.getPackageDeclarations(); if (decls.length == 0) { sourceFolders.add(packPath); } else { IPath relpath= new Path(decls[0].getElementName().replace('.', '/')); int remainingSegments= packPath.segmentCount() - relpath.segmentCount(); if (remainingSegments >= 0) { IPath prefix= packPath.uptoSegment(remainingSegments); IPath common= packPath.removeFirstSegments(remainingSegments); if (common.equals(relpath)) { sourceFolders.add(prefix); } } } } } } return true; } /** * Called from the wizard on cancel. */ public void performCancel() { if (fProjectCreated) { try { fMainPage.getProjectHandle().delete(false, false, null); } catch (CoreException e) { JavaPlugin.log(e); } } } }
28,563
Bug 28563 NPE on shutdown when JUnit view wasn't realized
null
resolved fixed
2b3fd3c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-17T20:48:21Z
2002-12-17T21:20:00Z
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.junit.ui; import java.net.MalformedURLException; import java.text.NumberFormat; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.util.Vector; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.*; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.custom.ViewForm; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.ToolBarManager; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorActionBarContributor; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.part.EditorActionBarContributor; import org.eclipse.ui.part.ViewPart; import org.eclipse.jdt.core.ElementChangedEvent; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IElementChangedListener; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElementDelta; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.internal.junit.runner.ITestRunListener; /** * A ViewPart that shows the results of a test run. */ public class TestRunnerViewPart extends ViewPart implements ITestRunListener, IPropertyChangeListener { public static final String NAME= "org.eclipse.jdt.junit.ResultView"; //$NON-NLS-1$ /** * Number of executed tests during a test run */ protected int fExecutedTests; /** * Number of errors during this test run */ protected int fErrors; /** * Number of failures during this test run */ protected int fFailures; /** * Number of tests run */ private int fTestCount; /** * Map storing TestInfos for each executed test keyed by * the test name. */ private Map fTestInfos = new HashMap(); /** * The first failure of a test run. Used to reveal the * first failed tests at the end of a run. */ private TestRunInfo fFirstFailure; private ProgressBar fProgressBar; private ProgressImages fProgressImages; private Image fViewImage; private CounterPanel fCounterPanel; private boolean fShowOnErrorOnly= false; /** * The view that shows the stack trace of a failure */ private FailureTraceView fFailureView; /** * The collection of ITestRunViews */ private Vector fTestRunViews = new Vector(); /** * The currently active run view */ private ITestRunView fActiveRunView; /** * Is the UI disposed */ private boolean fIsDisposed= false; /** * The launched project */ private IJavaProject fTestProject; /** * The launcher that has started the test */ private String fLaunchMode; private ILaunch fLastLaunch= null; /** * The client side of the remote test runner */ private RemoteTestRunnerClient fTestRunnerClient; final Image fStackViewIcon= TestRunnerViewPart.createImage("cview16/stackframe.gif");//$NON-NLS-1$ final Image fTestRunOKIcon= TestRunnerViewPart.createImage("cview16/junitsucc.gif"); //$NON-NLS-1$ final Image fTestRunFailIcon= TestRunnerViewPart.createImage("cview16/juniterr.gif"); //$NON-NLS-1$ final Image fTestRunOKDirtyIcon= TestRunnerViewPart.createImage("cview16/junitsuccq.gif"); //$NON-NLS-1$ final Image fTestRunFailDirtyIcon= TestRunnerViewPart.createImage("cview16/juniterrq.gif"); //$NON-NLS-1$ Image fOriginalViewImage= null; IElementChangedListener fDirtyListener= null; private class StopAction extends Action{ public StopAction() { setText(JUnitMessages.getString("TestRunnerViewPart.stopaction.text"));//$NON-NLS-1$ setToolTipText(JUnitMessages.getString("TestRunnerViewPart.stopaction.tooltip"));//$NON-NLS-1$ setDisabledImageDescriptor(JUnitPlugin.getImageDescriptor("dlcl16/stop.gif")); //$NON-NLS-1$ setHoverImageDescriptor(JUnitPlugin.getImageDescriptor("clcl16/stop.gif")); //$NON-NLS-1$ setImageDescriptor(JUnitPlugin.getImageDescriptor("elcl16/stop.gif")); //$NON-NLS-1$ } public void run() { stopTest(); } } private class RerunAction extends Action{ public RerunAction() { setText(JUnitMessages.getString("TestRunnerViewPart.rerunaction.label")); //$NON-NLS-1$ setToolTipText(JUnitMessages.getString("TestRunnerViewPart.rerunaction.tooltip")); //$NON-NLS-1$ setDisabledImageDescriptor(JUnitPlugin.getImageDescriptor("dlcl16/relaunch.gif")); //$NON-NLS-1$ setHoverImageDescriptor(JUnitPlugin.getImageDescriptor("clcl16/relaunch.gif")); //$NON-NLS-1$ setImageDescriptor(JUnitPlugin.getImageDescriptor("elcl16/relaunch.gif")); //$NON-NLS-1$ } public void run(){ rerunTestRun(); } } /** * Listen for for modifications to Java elements */ private class DirtyListener implements IElementChangedListener { public void elementChanged(ElementChangedEvent event) { processDelta(event.getDelta()); } private boolean processDelta(IJavaElementDelta delta) { int kind= delta.getKind(); int details= delta.getFlags(); int type= delta.getElement().getElementType(); switch (type) { // Consider containers for class files. case IJavaElement.JAVA_MODEL: case IJavaElement.JAVA_PROJECT: case IJavaElement.PACKAGE_FRAGMENT_ROOT: case IJavaElement.PACKAGE_FRAGMENT: // If we did some different than changing a child we flush the the undo / redo stack. if (kind != IJavaElementDelta.CHANGED || details != IJavaElementDelta.F_CHILDREN) { codeHasChanged(); return false; } break; case IJavaElement.COMPILATION_UNIT: ICompilationUnit unit= (ICompilationUnit)delta.getElement(); // If we change a working copy we do nothing if (unit.isWorkingCopy()) { // Don't examine children of a working copy but keep processing siblings. return true; } else { codeHasChanged(); return false; } case IJavaElement.CLASS_FILE: // Don't examine children of a class file but keep on examining siblings. return true; default: codeHasChanged(); return false; } IJavaElementDelta[] affectedChildren= delta.getAffectedChildren(); if (affectedChildren == null) return true; for (int i= 0; i < affectedChildren.length; i++) { if (!processDelta(affectedChildren[i])) return false; } return true; } } /** * Stops the currently running test and shuts down the RemoteTestRunner */ public void stopTest() { if (fTestRunnerClient != null) fTestRunnerClient.stopTest(); } /** * Stops the currently running test and shuts down the RemoteTestRunner */ public void rerunTestRun() { if (fLastLaunch != null && fLastLaunch.getLaunchConfiguration() != null) { try { DebugUITools.saveAndBuildBeforeLaunch(); fLastLaunch.getLaunchConfiguration().launch(fLastLaunch.getLaunchMode(), null); } catch (CoreException e) { ErrorDialog.openError(getSite().getShell(), JUnitMessages.getString("TestRunnerViewPart.error.cannotrerun"), e.getMessage(), e.getStatus() //$NON-NLS-1$ ); } } } /* * @see ITestRunListener#testRunStarted(testCount) */ public void testRunStarted(final int testCount){ reset(testCount); fShowOnErrorOnly= JUnitPreferencePage.getShowOnErrorOnly(); fExecutedTests++; } /* * @see ITestRunListener#testRunEnded */ public void testRunEnded(long elapsedTime){ fExecutedTests--; String msg= JUnitMessages.getFormattedString("TestRunnerViewPart.message.finish", elapsedTimeAsString(elapsedTime)); //$NON-NLS-1$ postInfo(msg); postAsyncRunnable(new Runnable() { public void run() { if(isDisposed()) return; if (fFirstFailure != null) { fActiveRunView.setSelectedTest(fFirstFailure.fTestName); handleTestSelected(fFirstFailure.fTestName); } updateViewIcon(); if (fDirtyListener == null) { fDirtyListener= new DirtyListener(); JavaCore.addElementChangedListener(fDirtyListener); } } }); } private void updateViewIcon() { if (fErrors+fFailures > 0) fViewImage= fTestRunFailIcon; else fViewImage= fTestRunOKIcon; firePropertyChange(IWorkbenchPart.PROP_TITLE); } private String elapsedTimeAsString(long runTime) { return NumberFormat.getInstance().format((double)runTime/1000); } /* * @see ITestRunListener#testRunStopped */ public void testRunStopped(final long elapsedTime) { String msg= JUnitMessages.getFormattedString("TestRunnerViewPart.message.stopped", elapsedTimeAsString(elapsedTime)); //$NON-NLS-1$ postInfo(msg); postAsyncRunnable(new Runnable() { public void run() { if(isDisposed()) return; resetViewIcon(); } }); } private void resetViewIcon() { fViewImage= fOriginalViewImage; firePropertyChange(IWorkbenchPart.PROP_TITLE); } /* * @see ITestRunListener#testRunTerminated */ public void testRunTerminated() { String msg= JUnitMessages.getString("TestRunnerViewPart.message.terminated"); //$NON-NLS-1$ showMessage(msg); } private void showMessage(String msg) { showInformation(msg); postError(msg); } /* * @see ITestRunListener#testStarted */ public void testStarted(String testName) { // reveal the part when the first test starts if (!fShowOnErrorOnly && fExecutedTests == 1) postShowTestResultsView(); postInfo(JUnitMessages.getFormattedString("TestRunnerViewPart.message.started", testName)); //$NON-NLS-1$ TestRunInfo testInfo= getTestInfo(testName); if (testInfo == null) fTestInfos.put(testName, new TestRunInfo(testName)); } /* * @see ITestRunListener#testEnded */ public void testEnded(String testName){ postEndTest(testName); fExecutedTests++; } /* * @see ITestRunListener#testFailed */ public void testFailed(int status, String testName, String trace){ TestRunInfo testInfo= getTestInfo(testName); if (testInfo == null) { testInfo= new TestRunInfo(testName); fTestInfos.put(testName, testInfo); } testInfo.fTrace= trace; testInfo.fStatus= status; if (status == ITestRunListener.STATUS_ERROR) fErrors++; else fFailures++; if (fFirstFailure == null) fFirstFailure= testInfo; // show the view on the first error only if (fShowOnErrorOnly && (fErrors + fFailures == 1)) postShowTestResultsView(); } /* * @see ITestRunListener#testReran */ public void testReran(String className, String testName, int status, String trace) { if (status == ITestRunListener.STATUS_ERROR) { String msg= JUnitMessages.getFormattedString("TestRunnerViewPart.message.error", new String[]{testName, className}); //$NON-NLS-1$ postError(msg); } else if (status == ITestRunListener.STATUS_FAILURE) { String msg= JUnitMessages.getFormattedString("TestRunnerViewPart.message.failure", new String[]{testName, className}); //$NON-NLS-1$ postError(msg); } else { String msg= JUnitMessages.getFormattedString("TestRunnerViewPart.message.success", new String[]{testName, className}); //$NON-NLS-1$ postInfo(msg); } String test= testName+"("+className+")"; //$NON-NLS-1$ //$NON-NLS-2$ TestRunInfo info= getTestInfo(test); updateTest(info, status); if (info.fTrace == null || !info.fTrace.equals(trace)) { info.fTrace= trace; showFailure(info.fTrace); } } private void updateTest(TestRunInfo info, final int status) { if (status == info.fStatus) return; if (info.fStatus == ITestRunListener.STATUS_OK) { if (status == ITestRunListener.STATUS_FAILURE) fFailures++; else if (status == ITestRunListener.STATUS_ERROR) fErrors++; } else if (info.fStatus == ITestRunListener.STATUS_ERROR) { if (status == ITestRunListener.STATUS_OK) fErrors--; else if (status == ITestRunListener.STATUS_FAILURE) { fErrors--; fFailures++; } } else if (info.fStatus == ITestRunListener.STATUS_FAILURE) { if (status == ITestRunListener.STATUS_OK) fFailures--; else if (status == ITestRunListener.STATUS_ERROR) { fFailures--; fErrors++; } } info.fStatus= status; final TestRunInfo finalInfo= info; postAsyncRunnable(new Runnable() { public void run() { refreshCounters(); for (Enumeration e= fTestRunViews.elements(); e.hasMoreElements();) { ITestRunView v= (ITestRunView) e.nextElement(); v.testStatusChanged(finalInfo); } } }); } /* * @see ITestRunListener#testTreeEntry */ public void testTreeEntry(final String treeEntry){ postSyncRunnable(new Runnable() { public void run() { if(isDisposed()) return; for (Enumeration e= fTestRunViews.elements(); e.hasMoreElements();) { ITestRunView v= (ITestRunView) e.nextElement(); v.newTreeEntry(treeEntry); } } }); } public void startTestRunListening(IJavaElement type, int port, ILaunch launch) { fTestProject= type.getJavaProject(); fLaunchMode= launch.getLaunchMode(); aboutToLaunch(); if (fTestRunnerClient != null) { stopTest(); } fTestRunnerClient= new RemoteTestRunnerClient(); fTestRunnerClient.startListening(this, port); fLastLaunch= launch; String title= JUnitMessages.getFormattedString("TestRunnerViewPart.title", type.getElementName()); //$NON-NLS-1$ setTitle(title); if (type instanceof IType) setTitleToolTip(((IType)type).getFullyQualifiedName()); else setTitleToolTip(type.getElementName()); } private void aboutToLaunch() { String msg= JUnitMessages.getString("TestRunnerViewPart.message.launching"); //$NON-NLS-1$ showInformation(msg); postInfo(msg); fViewImage= fOriginalViewImage; firePropertyChange(IWorkbenchPart.PROP_TITLE); } public void rerunTest(String className, String testName) { if (fTestRunnerClient != null && fTestRunnerClient.isRunning() && ILaunchManager.DEBUG_MODE.equals(fLaunchMode)) fTestRunnerClient.rerunTest(className, testName); else { MessageDialog.openInformation(getSite().getShell(), JUnitMessages.getString("TestRunnerViewPart.cannotrerun.title"), //$NON-NLS-1$ JUnitMessages.getString("TestRunnerViewPart.cannotrerurn.message") //$NON-NLS-1$ ); } } public synchronized void dispose(){ fIsDisposed= true; stopTest(); fProgressImages.dispose(); JUnitPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); fTestRunOKIcon.dispose(); fTestRunFailIcon.dispose(); fStackViewIcon.dispose(); fTestRunOKDirtyIcon.dispose(); fTestRunFailDirtyIcon.dispose(); } private void start(final int total) { resetProgressBar(total); fCounterPanel.setTotal(total); fCounterPanel.setRunValue(0); } private void resetProgressBar(final int total) { fProgressBar.setMinimum(0); fProgressBar.setSelection(0); fProgressBar.setForeground(getDisplay().getSystemColor(SWT.COLOR_GREEN)); fProgressBar.setMaximum(total); } private void postSyncRunnable(Runnable r) { if (!isDisposed()) getDisplay().syncExec(r); } private void postAsyncRunnable(Runnable r) { if (!isDisposed()) getDisplay().syncExec(r); } private void aboutToStart() { postSyncRunnable(new Runnable() { public void run() { if (!isDisposed()) { for (Enumeration e= fTestRunViews.elements(); e.hasMoreElements();) { ITestRunView v= (ITestRunView) e.nextElement(); v.aboutToStart(); } } } }); } private void postEndTest(final String testName) { postSyncRunnable(new Runnable() { public void run() { if(isDisposed()) return; handleEndTest(); for (Enumeration e= fTestRunViews.elements(); e.hasMoreElements();) { ITestRunView v= (ITestRunView) e.nextElement(); v.endTest(testName); } } }); } private void handleEndTest() { refreshCounters(); updateProgressColor(fFailures+fErrors); fProgressBar.setSelection(fProgressBar.getSelection() + 1); if (fShowOnErrorOnly) { Image progress= fProgressImages.getImage(fExecutedTests, fTestCount, fErrors, fFailures); if (progress != fViewImage) { fViewImage= progress; firePropertyChange(IWorkbenchPart.PROP_TITLE); } } } private void updateProgressColor(int failures) { if (failures > 0) fProgressBar.setForeground(getDisplay().getSystemColor(SWT.COLOR_RED)); else fProgressBar.setForeground(getDisplay().getSystemColor(SWT.COLOR_GREEN)); } private void refreshCounters() { fCounterPanel.setErrorValue(fErrors); fCounterPanel.setFailureValue(fFailures); fCounterPanel.setRunValue(fExecutedTests); updateProgressColor(fErrors + fFailures); } protected void postShowTestResultsView() { postAsyncRunnable(new Runnable() { public void run() { if (isDisposed()) return; showTestResultsView(); } }); } public void showTestResultsView() { IWorkbenchWindow window= getSite().getWorkbenchWindow(); IWorkbenchPage page= window.getActivePage(); TestRunnerViewPart testRunner= null; if (page != null) { try { // show the result view testRunner= (TestRunnerViewPart)page.findView(TestRunnerViewPart.NAME); if(testRunner == null) { IWorkbenchPart activePart= page.getActivePart(); testRunner= (TestRunnerViewPart)page.showView(TestRunnerViewPart.NAME); //restore focus stolen by the creation of the console page.activate(activePart); } else { page.bringToTop(testRunner); } } catch (PartInitException pie) { JUnitPlugin.log(pie); } } } protected void postInfo(final String message) { postAsyncRunnable(new Runnable() { public void run() { if (isDisposed()) return; getStatusLine().setErrorMessage(null); getStatusLine().setMessage(message); } }); } protected void postError(final String message) { postAsyncRunnable(new Runnable() { public void run() { if (isDisposed()) return; getStatusLine().setMessage(null); getStatusLine().setErrorMessage(message); } }); } protected void showInformation(final String info){ postSyncRunnable(new Runnable() { public void run() { if (!isDisposed()) fFailureView.setInformation(info); } }); } private CTabFolder createTestRunViews(Composite parent) { CTabFolder tabFolder= new CTabFolder(parent, SWT.TOP); tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL)); ITestRunView failureRunView= new FailureRunView(tabFolder, this); ITestRunView testHierarchyRunView= new HierarchyRunView(tabFolder, this); fTestRunViews.addElement(failureRunView); fTestRunViews.addElement(testHierarchyRunView); tabFolder.setSelection(0); fActiveRunView= (ITestRunView)fTestRunViews.firstElement(); tabFolder.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { testViewChanged(event); } }); return tabFolder; } private void testViewChanged(SelectionEvent event) { for (Enumeration e= fTestRunViews.elements(); e.hasMoreElements();) { ITestRunView v= (ITestRunView) e.nextElement(); if (((CTabFolder) event.widget).getSelection().getText() == v.getName()){ v.setSelectedTest(fActiveRunView.getTestName()); fActiveRunView= v; fActiveRunView.activate(); } } } private SashForm createSashForm(Composite parent) { SashForm sashForm= new SashForm(parent, SWT.VERTICAL); ViewForm top= new ViewForm(sashForm, SWT.NONE); CTabFolder tabFolder= createTestRunViews(top); tabFolder.setLayoutData(new TabFolderLayout()); top.setContent(tabFolder); ViewForm bottom= new ViewForm(sashForm, SWT.NONE); ToolBar failureToolBar= new ToolBar(bottom, SWT.FLAT | SWT.WRAP); bottom.setTopCenter(failureToolBar); fFailureView= new FailureTraceView(bottom, this); bottom.setContent(fFailureView.getComposite()); CLabel label= new CLabel(bottom, SWT.NONE); label.setText(JUnitMessages.getString("TestRunnerViewPart.label.failure")); //$NON-NLS-1$ label.setImage(fStackViewIcon); bottom.setTopLeft(label); // fill the failure trace viewer toolbar ToolBarManager failureToolBarmanager= new ToolBarManager(failureToolBar); failureToolBarmanager.add(new EnableStackFilterAction(fFailureView)); failureToolBarmanager.update(true); sashForm.setWeights(new int[]{50, 50}); return sashForm; } private void reset(final int testCount) { postAsyncRunnable(new Runnable() { public void run() { if (isDisposed()) return; fCounterPanel.reset(); fFailureView.clear(); clearStatus(); start(testCount); } }); fExecutedTests= 0; fFailures= 0; fErrors= 0; fTestCount= testCount; aboutToStart(); fTestInfos.clear(); fFirstFailure= null; } private void clearStatus() { getStatusLine().setMessage(null); getStatusLine().setErrorMessage(null); } public void setFocus() { if (fActiveRunView != null) fActiveRunView.setFocus(); } public void createPartControl(Composite parent) { GridLayout gridLayout= new GridLayout(); gridLayout.marginWidth= 0; parent.setLayout(gridLayout); IActionBars actionBars= getViewSite().getActionBars(); IToolBarManager toolBar= actionBars.getToolBarManager(); toolBar.add(new StopAction()); toolBar.add(new RerunAction()); actionBars.updateActionBars(); Composite counterPanel= createProgressCountPanel(parent); counterPanel.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); SashForm sashForm= createSashForm(parent); sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); actionBars.setGlobalActionHandler( IWorkbenchActionConstants.COPY, new CopyTraceAction(fFailureView)); JUnitPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); fOriginalViewImage= getTitleImage(); fProgressImages= new ProgressImages(); WorkbenchHelp.setHelp(parent, IJUnitHelpContextIds.RESULTS_VIEW); } private IStatusLineManager getStatusLine() { // we want to show messages globally hence we // have to go throgh the active part IViewSite site= getViewSite(); IWorkbenchPage page= site.getPage(); IWorkbenchPart activePart= page.getActivePart(); if (activePart instanceof IViewPart) { IViewPart activeViewPart= (IViewPart)activePart; IViewSite activeViewSite= activeViewPart.getViewSite(); return activeViewSite.getActionBars().getStatusLineManager(); } if (activePart instanceof IEditorPart) { IEditorPart activeEditorPart= (IEditorPart)activePart; IEditorActionBarContributor contributor= activeEditorPart.getEditorSite().getActionBarContributor(); if (contributor instanceof EditorActionBarContributor) return ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager(); } // no active part return getViewSite().getActionBars().getStatusLineManager(); } private Composite createProgressCountPanel(Composite parent) { Composite composite= new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); fProgressBar = new ProgressBar(composite, SWT.HORIZONTAL); fProgressBar.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); fCounterPanel = new CounterPanel(composite); fCounterPanel.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); return composite; } public TestRunInfo getTestInfo(String testName) { return (TestRunInfo) fTestInfos.get(testName); } public void handleTestSelected(String testName) { TestRunInfo testInfo= getTestInfo(testName); if (testInfo == null) { showFailure(""); //$NON-NLS-1$ } else { showFailure(testInfo.fTrace); } } private void showFailure(final String failure) { postSyncRunnable(new Runnable() { public void run() { if (!isDisposed()) fFailureView.showFailure(failure); } }); } public IJavaProject getLaunchedProject() { return fTestProject; } protected static Image createImage(String path) { try { ImageDescriptor id= ImageDescriptor.createFromURL(JUnitPlugin.makeIconFileURL(path)); return id.createImage(); } catch (MalformedURLException e) { // fall through } return null; } private boolean isDisposed() { return fIsDisposed || fCounterPanel.isDisposed(); } private Display getDisplay() { return getViewSite().getShell().getDisplay(); } /** * @see IWorkbenchPart#getTitleImage() */ public Image getTitleImage() { if (fOriginalViewImage == null) fOriginalViewImage= super.getTitleImage(); if (fViewImage == null) return super.getTitleImage(); return fViewImage; } public void propertyChange(PropertyChangeEvent event) { if (isDisposed()) return; if (IJUnitPreferencesConstants.SHOW_ON_ERROR_ONLY.equals(event.getProperty())) { if (!JUnitPreferencePage.getShowOnErrorOnly()) { fViewImage= fOriginalViewImage; firePropertyChange(IWorkbenchPart.PROP_TITLE); } } } void codeHasChanged() { postAsyncRunnable(new Runnable() { public void run() { if (isDisposed()) return; if (fDirtyListener != null) { JavaCore.removeElementChangedListener(fDirtyListener); fDirtyListener= null; } if (fViewImage == fTestRunOKIcon) fViewImage= fTestRunOKDirtyIcon; else if (fViewImage == fTestRunFailIcon) fViewImage= fTestRunFailDirtyIcon; firePropertyChange(IWorkbenchPart.PROP_TITLE); } }); } boolean isCreated() { return fCounterPanel != null; } }
22,446
Bug 22446 Importing folder into itself causes "infinite" recursion [ccp]
null
resolved fixed
55bb732
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-18T14:59:12Z
2002-08-14T18:33:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.ui.packageview; import java.io.File; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DropTargetEvent; import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.core.resources.IContainer; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.ui.dialogs.IOverwriteQuery; import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider; import org.eclipse.ui.wizards.datatransfer.ImportOperation; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.dnd.JdtViewerDropAdapter; import org.eclipse.jdt.internal.ui.dnd.TransferDropTargetListener; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; import org.eclipse.jdt.internal.ui.util.SWTUtil; /** * Adapter to handle file drop from other applications. */ class FileTransferDropAdapter extends JdtViewerDropAdapter implements IOverwriteQuery, TransferDropTargetListener { FileTransferDropAdapter(AbstractTreeViewer viewer) { super(viewer, DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND); } //---- IOverwriteQuery ------------------------------------------------------------ public String queryOverwrite(String file) { // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=19367 String[] returnCodes= {YES, ALL, NO, CANCEL}; int returnVal= openDialog(getViewer().getControl(), file); return returnVal < 0 ? CANCEL : returnCodes[returnVal]; } private int openDialog(final Control control, final String file) { final int[] result= { Dialog.CANCEL }; control.getDisplay().syncExec(new Runnable() { public void run() { String title= PackagesMessages.getString("DropAdapter.question"); //$NON-NLS-1$ String msg= PackagesMessages.getFormattedString("DropAdapter.alreadyExists", file); //$NON-NLS-1$ String[] options= {IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}; MessageDialog dialog= new MessageDialog(control.getShell(), title, null, msg, MessageDialog.QUESTION, options, 0); result[0]= dialog.open(); } }); return result[0]; } //---- TransferDropTargetListener interface --------------------------------------- public Transfer getTransfer() { return FileTransfer.getInstance(); } //---- Actual DND ----------------------------------------------------------------- public void validateDrop(Object target, DropTargetEvent event, int operation) { event.detail= DND.DROP_NONE; boolean isPackageFragment= target instanceof IPackageFragment; boolean isJavaProject= target instanceof IJavaProject; boolean isPackageFragmentRoot= target instanceof IPackageFragmentRoot; boolean isContainer= target instanceof IContainer; if (!(isPackageFragment || isJavaProject || isPackageFragmentRoot || isContainer)) return; if (isContainer) { IContainer container= (IContainer)target; if (!container.isReadOnly()) event.detail= DND.DROP_COPY; } else { IJavaElement element= (IJavaElement)target; if (!element.isReadOnly()) event.detail= DND.DROP_COPY; } return; } public void drop(Object dropTarget, DropTargetEvent event) { int operation= event.detail; event.detail= DND.DROP_NONE; Object data= event.data; if (data == null || operation != DND.DROP_COPY) return; IContainer target= null; if (dropTarget instanceof IContainer) { target= (IContainer)dropTarget; } else { try { target= (IContainer)((IJavaElement)dropTarget).getCorrespondingResource(); } catch (JavaModelException e) { } } if (target == null) return; List files= checkFiles(SWTUtil.getShell(event.widget),(String[])data, target.getLocation()); if (files.size() > 0) { Shell shell= JavaPlugin.getActiveWorkbenchShell(); ImportOperation op= new ImportOperation(target.getFullPath(), FileSystemStructureProvider.INSTANCE, this, files); op.setCreateContainerStructure(false); ProgressMonitorDialog dialog= new ProgressMonitorDialog(shell); try { dialog.run(true, true, op); } catch (InvocationTargetException e) { String title= PackagesMessages.getString("DropAdapter.errorTitle"); //$NON-NLS-1$ String message= PackagesMessages.getString("DropAdapter.errorMessage"); //$NON-NLS-1$ ExceptionHandler.handle(e, title, message); return; } catch (InterruptedException e) { return; } // Special case since ImportOperation doesn't throw a CoreException on // failure. IStatus status= op.getStatus(); if (! status.isOK()) { String title= PackagesMessages.getString("DropAdapter.errorTitle"); //$NON-NLS-1$ String message= PackagesMessages.getString("DropAdapter.errorMessage"); //$NON-NLS-1$ ErrorDialog.openError(shell, title, message, status, IStatus.ERROR | IStatus.WARNING); return; } // The files we have really handled. event.data= files.toArray(new String[files.size()]); // Import always performs a copy. event.detail= DND.DROP_COPY; return; } else { event.data= null; return; } } private List checkFiles(Shell shell, String[] files, IPath target) { List result= new ArrayList(10); int lengthCompare= target.segmentCount() + 1; for (int i= 0; i < files.length; i++) { String file= files[i]; IPath path= new Path(file); String error= null; if (path.equals(target)) { error= PackagesMessages.getFormattedString("DropAdapter.errorSame", target.lastSegment()); //$NON-NLS-1$ } else if (path.isPrefixOf(target)) { error= PackagesMessages.getFormattedString("DropAdapter.errorSubfolder", path.lastSegment()); //$NON-NLS-1$ } if (error != null) { MessageDialog.openError(shell, PackagesMessages.getString("DropAdapter.errorTitle"), error); //$NON-NLS-1$ return new ArrayList(0); } // A copy onto itself ? if (target.isPrefixOf(path) && lengthCompare == path.segmentCount()) continue; result.add(new File(file)); } return result; } }
23,553
Bug 23553 Type Hierarchy shows wrong drop cursor
If you drag and drop a Java Element onto the Type Hierarchy, there are several different reactions depending on the drop target you point at: 1. Point at a binary type -> NO DROP cursor: no drop possible 2. Point at source type -> COPY cursor: copies the drag source into the target 3. Point at the TreeViewer, but NOT at an element (i.e. besides or below of the tree's items) -> COPY cursor: doesn't copy, but sets hierarchy's focus to the drag source. Case 3 is confusing. We shouldn't show a copy cursor if we are not going to copy anything. The right cursor for this 'setFocus' action is the LINK cursor. The current behaviour is even more confusing because placing the mouse besides a type label highlights the label (even though that label has nothing to do with the 'setFocus' action that is triggered on mouseup). Using the link cursor would allow a visual discrimination between these two highly differing actions.
resolved fixed
c273ede
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-18T15:05:45Z
2002-09-13T12:26:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyTransferDropAdapter.java
/******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.internal.ui.typehierarchy; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DropTargetEvent; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.internal.ui.packageview.SelectionTransferDropAdapter; import org.eclipse.jdt.internal.ui.util.OpenTypeHierarchyUtil; import org.eclipse.jdt.internal.ui.util.SelectionUtil; public class TypeHierarchyTransferDropAdapter extends SelectionTransferDropAdapter { private TypeHierarchyViewPart fTypeHierarchyViewPart; public TypeHierarchyTransferDropAdapter(TypeHierarchyViewPart viewPart, AbstractTreeViewer viewer) { super(viewer); fTypeHierarchyViewPart= viewPart; } public void validateDrop(Object target, DropTargetEvent event, int operation) { event.detail= DND.DROP_NONE; initializeSelection(); if (target != null){ super.validateDrop(target, event, operation); return; } if (getInputElement(getSelection()) != null) event.detail= DND.DROP_COPY; } public void drop(Object target, DropTargetEvent event) { if (target != null || event.detail != DND.DROP_COPY){ super.drop(target, event); return; } IJavaElement input= getInputElement(getSelection()); fTypeHierarchyViewPart.setInputElement(input); if (input instanceof IMember) fTypeHierarchyViewPart.selectMember((IMember) input); } private static IJavaElement getInputElement(ISelection selection) { Object single= SelectionUtil.getSingleElement(selection); if (single == null) return null; IJavaElement[] candidates= OpenTypeHierarchyUtil.getCandidates(single); if (candidates != null && candidates.length > 0) return candidates[0]; return null; } }
26,956
Bug 26956 Rename not allowed when package fragement with same name exists in different source folder [refactoring]
Build I20021119 Create the following structure Test src org.eclipse.code tests org.eclipse.code.tests Now try to rename org.eclipse.code.tests to org.eclipse.code. You get an error that the package already exists in project Test. That's correct but the package lies in a different source folder. We should allow this case.
resolved fixed
10970a9
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-19T09:37:22Z
2002-11-22T15:46:40Z
org.eclipse.jdt.ui/core
26,956
Bug 26956 Rename not allowed when package fragement with same name exists in different source folder [refactoring]
Build I20021119 Create the following structure Test src org.eclipse.code tests org.eclipse.code.tests Now try to rename org.eclipse.code.tests to org.eclipse.code. You get an error that the package already exists in project Test. That's correct but the package lies in a different source folder. We should allow this case.
resolved fixed
10970a9
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-19T09:37:22Z
2002-11-22T15:46:40Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenamePackageRefactoring.java
26,242
Bug 26242 inline local variable - removes comments [refactoring]
I-20021113 w2k w/ jdt.core patch: public class Test0 { void foo() { final int value= 42; // some valuable important comment which will be erased System.out.println(value); } }
resolved fixed
69abccd
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T09:30:21Z
2002-11-14T10:33:20Z
org.eclipse.jdt.ui/core
26,242
Bug 26242 inline local variable - removes comments [refactoring]
I-20021113 w2k w/ jdt.core patch: public class Test0 { void foo() { final int value= 42; // some valuable important comment which will be erased System.out.println(value); } }
resolved fixed
69abccd
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T09:30:21Z
2002-11-14T10:33:20Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineTempRefactoring.java
28,698
Bug 28698 Ctrl+O (show outline) does not work if the file being shown in the editor is read only
M4 The summary tells all. Works if the file is not read only. Is this by design?
closed fixed
b778695
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T09:43:52Z
2002-12-19T20:33:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitEditor.java
/********************************************************************** Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html Contributors: IBM Corporation - Initial implementation **********************************************************************/ package org.eclipse.jdt.internal.ui.javaeditor; import java.lang.reflect.InvocationTargetException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.custom.VerifyKeyListener; import org.eclipse.swt.events.VerifyEvent; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.text.AbstractHoverInformationControlManager; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ILineTracker; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextOperationTarget; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.ITextViewerExtension; import org.eclipse.jface.text.ITextViewerExtension3; import org.eclipse.jface.text.ITypedRegion; import org.eclipse.jface.text.IWidgetTokenKeeper; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.Region; import org.eclipse.jface.text.contentassist.ContentAssistant; import org.eclipse.jface.text.contentassist.IContentAssistant; import org.eclipse.jface.text.source.Annotation; import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.IVerticalRuler; import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.actions.ActionContext; import org.eclipse.ui.actions.ActionGroup; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.ui.dialogs.SaveAsDialog; import org.eclipse.ui.editors.text.IStorageDocumentProvider; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.texteditor.ContentAssistAction; import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.IEditorStatusLine; import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.ui.texteditor.MarkerAnnotation; import org.eclipse.ui.texteditor.TextOperationAction; import org.eclipse.ui.views.tasklist.TaskList; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IImportContainer; import org.eclipse.jdt.core.IImportDeclaration; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.ISourceRange; import org.eclipse.jdt.core.ISourceReference; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.IWorkingCopyManager; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.ui.actions.GenerateActionGroup; import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds; import org.eclipse.jdt.ui.actions.RefactorActionGroup; import org.eclipse.jdt.ui.text.JavaTextTools; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.actions.CompositeActionGroup; import org.eclipse.jdt.internal.ui.compare.LocalHistoryActionGroup; import org.eclipse.jdt.internal.ui.javaeditor.selectionactions.GoToNextPreviousMemberAction; import org.eclipse.jdt.internal.ui.javaeditor.selectionactions.SelectionHistory; import org.eclipse.jdt.internal.ui.javaeditor.selectionactions.StructureSelectEnclosingAction; import org.eclipse.jdt.internal.ui.javaeditor.selectionactions.StructureSelectHistoryAction; import org.eclipse.jdt.internal.ui.javaeditor.selectionactions.StructureSelectNextAction; import org.eclipse.jdt.internal.ui.javaeditor.selectionactions.StructureSelectPreviousAction; import org.eclipse.jdt.internal.ui.javaeditor.selectionactions.StructureSelectionAction; import org.eclipse.jdt.internal.ui.preferences.JavaEditorPreferencePage; import org.eclipse.jdt.internal.ui.text.ContentAssistPreference; import org.eclipse.jdt.internal.ui.text.JavaPairMatcher; import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionSourceViewer; import org.eclipse.jdt.internal.ui.text.java.IReconcilingParticipant; import org.eclipse.jdt.internal.ui.text.java.SmartBracesAutoEditStrategy; import org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager; import org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI; import org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.ExitFlags; /** * Java specific text editor. */ public class CompilationUnitEditor extends JavaEditor implements IReconcilingParticipant { interface ITextConverter { void customizeDocumentCommand(IDocument document, DocumentCommand command); }; class AdaptedRulerLayout extends Layout { protected int fGap; protected AdaptedSourceViewer fAdaptedSourceViewer; protected AdaptedRulerLayout(int gap, AdaptedSourceViewer asv) { fGap= gap; fAdaptedSourceViewer= asv; } protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { Control[] children= composite.getChildren(); Point s= children[children.length - 1].computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache); if (fAdaptedSourceViewer.isVerticalRulerVisible()) s.x += fAdaptedSourceViewer.getVerticalRuler().getWidth() + fGap; return s; } protected void layout(Composite composite, boolean flushCache) { Rectangle clArea= composite.getClientArea(); if (fAdaptedSourceViewer.isVerticalRulerVisible()) { StyledText textWidget= fAdaptedSourceViewer.getTextWidget(); Rectangle trim= textWidget.computeTrim(0, 0, 0, 0); int scrollbarHeight= trim.height; IVerticalRuler vr= fAdaptedSourceViewer.getVerticalRuler(); int vrWidth=vr.getWidth(); int orWidth= 0; if (fAdaptedSourceViewer.isOverviewRulerVisible()) { OverviewRuler or= fAdaptedSourceViewer.getOverviewRuler(); orWidth= or.getWidth(); or.getControl().setBounds(clArea.width - orWidth, scrollbarHeight, orWidth, clArea.height - 3*scrollbarHeight); } textWidget.setBounds(vrWidth + fGap, 0, clArea.width - vrWidth - orWidth - 2*fGap, clArea.height); vr.getControl().setBounds(0, 0, vrWidth, clArea.height - scrollbarHeight); } else { StyledText textWidget= fAdaptedSourceViewer.getTextWidget(); textWidget.setBounds(0, 0, clArea.width, clArea.height); } } }; class AdaptedSourceViewer extends JavaCorrectionSourceViewer { private List fTextConverters; private OverviewRuler fOverviewRuler; private boolean fIsOverviewRulerVisible; /** The viewer's overview ruler hovering controller */ private AbstractHoverInformationControlManager fOverviewRulerHoveringController; private boolean fIgnoreTextConverters= false; private IVerticalRuler fCachedVerticalRuler; private boolean fCachedIsVerticalRulerVisible; public AdaptedSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { super(parent, ruler, styles, CompilationUnitEditor.this); fCachedVerticalRuler= ruler; fCachedIsVerticalRulerVisible= (ruler != null); fOverviewRuler= new OverviewRuler(VERTICAL_RULER_WIDTH); delayedCreateControl(parent, styles); } /* * @see ISourceViewer#showAnnotations(boolean) */ public void showAnnotations(boolean show) { fCachedIsVerticalRulerVisible= (show && fCachedVerticalRuler != null); super.showAnnotations(show); } public IContentAssistant getContentAssistant() { return fContentAssistant; } /* * @see ITextOperationTarget#doOperation(int) */ public void doOperation(int operation) { if (getTextWidget() == null) return; switch (operation) { case CONTENTASSIST_PROPOSALS: String msg= fContentAssistant.showPossibleCompletions(); setStatusLineErrorMessage(msg); return; case UNDO: fIgnoreTextConverters= true; break; case REDO: fIgnoreTextConverters= true; break; } super.doOperation(operation); } public void insertTextConverter(ITextConverter textConverter, int index) { throw new UnsupportedOperationException(); } public void addTextConverter(ITextConverter textConverter) { if (fTextConverters == null) { fTextConverters= new ArrayList(1); fTextConverters.add(textConverter); } else if (!fTextConverters.contains(textConverter)) fTextConverters.add(textConverter); } public void removeTextConverter(ITextConverter textConverter) { if (fTextConverters != null) { fTextConverters.remove(textConverter); if (fTextConverters.size() == 0) fTextConverters= null; } } /* * @see TextViewer#customizeDocumentCommand(DocumentCommand) */ protected void customizeDocumentCommand(DocumentCommand command) { super.customizeDocumentCommand(command); if (!fIgnoreTextConverters && fTextConverters != null) { for (Iterator e = fTextConverters.iterator(); e.hasNext();) ((ITextConverter) e.next()).customizeDocumentCommand(getDocument(), command); } fIgnoreTextConverters= false; } public IVerticalRuler getVerticalRuler() { return fCachedVerticalRuler; } public boolean isVerticalRulerVisible() { return fCachedIsVerticalRulerVisible; } public OverviewRuler getOverviewRuler() { return fOverviewRuler; } /* * @see TextViewer#createControl(Composite, int) */ protected void createControl(Composite parent, int styles) { // do nothing here } protected void delayedCreateControl(Composite parent, int styles) { //create the viewer super.createControl(parent, styles); Control control= getControl(); if (control instanceof Composite) { Composite composite= (Composite) control; composite.setLayout(new AdaptedRulerLayout(GAP_SIZE, this)); fOverviewRuler.createControl(composite, this); } } private void ensureOverviewHoverManagerInstalled() { if (fOverviewRulerHoveringController == null && fAnnotationHover != null && fHoverControlCreator != null) { fOverviewRulerHoveringController= new OverviewRulerHoverManager(fOverviewRuler, this, fAnnotationHover, fHoverControlCreator); fOverviewRulerHoveringController.install(fOverviewRuler.getControl()); } } public void hideOverviewRuler() { fIsOverviewRulerVisible= false; Control control= getControl(); if (control instanceof Composite) { Composite composite= (Composite) control; composite.layout(); } if (fOverviewRulerHoveringController != null) { fOverviewRulerHoveringController.dispose(); fOverviewRulerHoveringController= null; } } public void showOverviewRuler() { fIsOverviewRulerVisible= true; Control control= getControl(); if (control instanceof Composite) { Composite composite= (Composite) control; composite.layout(); } ensureOverviewHoverManagerInstalled(); } public boolean isOverviewRulerVisible() { return fIsOverviewRulerVisible; } /* * @see ISourceViewer#setDocument(IDocument, IAnnotationModel, int, int) */ public void setDocument(IDocument document, IAnnotationModel annotationModel, int visibleRegionOffset, int visibleRegionLength) { super.setDocument(document, annotationModel, visibleRegionOffset, visibleRegionLength); fOverviewRuler.setModel(annotationModel); } // http://dev.eclipse.org/bugs/show_bug.cgi?id=19270 public void updateIndentationPrefixes() { SourceViewerConfiguration configuration= getSourceViewerConfiguration(); String[] types= configuration.getConfiguredContentTypes(this); for (int i= 0; i < types.length; i++) { String[] prefixes= configuration.getIndentPrefixes(this, types[i]); if (prefixes != null && prefixes.length > 0) setIndentPrefixes(prefixes, types[i]); } } /* * @see IWidgetTokenOwner#requestWidgetToken(IWidgetTokenKeeper) */ public boolean requestWidgetToken(IWidgetTokenKeeper requester) { if (WorkbenchHelp.isContextHelpDisplayed()) return false; return super.requestWidgetToken(requester); } /* * @see org.eclipse.jface.text.source.ISourceViewer#configure(org.eclipse.jface.text.source.SourceViewerConfiguration) */ public void configure(SourceViewerConfiguration configuration) { super.configure(configuration); prependAutoEditStrategy(new SmartBracesAutoEditStrategy(this), IDocument.DEFAULT_CONTENT_TYPE); } protected void handleDispose() { fOverviewRuler= null; if (fOverviewRulerHoveringController != null) { fOverviewRulerHoveringController.dispose(); fOverviewRulerHoveringController= null; } super.handleDispose(); } }; static class TabConverter implements ITextConverter { private int fTabRatio; private ILineTracker fLineTracker; public TabConverter() { } public void setNumberOfSpacesPerTab(int ratio) { fTabRatio= ratio; } public void setLineTracker(ILineTracker lineTracker) { fLineTracker= lineTracker; } private int insertTabString(StringBuffer buffer, int offsetInLine) { if (fTabRatio == 0) return 0; int remainder= offsetInLine % fTabRatio; remainder= fTabRatio - remainder; for (int i= 0; i < remainder; i++) buffer.append(' '); return remainder; } public void customizeDocumentCommand(IDocument document, DocumentCommand command) { String text= command.text; if (text == null) return; int index= text.indexOf('\t'); if (index > -1) { StringBuffer buffer= new StringBuffer(); fLineTracker.set(command.text); int lines= fLineTracker.getNumberOfLines(); try { for (int i= 0; i < lines; i++) { int offset= fLineTracker.getLineOffset(i); int endOffset= offset + fLineTracker.getLineLength(i); String line= text.substring(offset, endOffset); int position= 0; if (i == 0) { IRegion firstLine= document.getLineInformationOfOffset(command.offset); position= command.offset - firstLine.getOffset(); } int length= line.length(); for (int j= 0; j < length; j++) { char c= line.charAt(j); if (c == '\t') { position += insertTabString(buffer, position); } else { buffer.append(c); ++ position; } } } command.text= buffer.toString(); } catch (BadLocationException x) { } } } }; private class PropertyChangeListener implements IPropertyChangeListener { /* * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) { handlePreferencePropertyChanged(event); } } /* Preference key for code formatter tab size */ private final static String CODE_FORMATTER_TAB_SIZE= JavaCore.FORMATTER_TAB_SIZE; /** Preference key for matching brackets */ private final static String MATCHING_BRACKETS= PreferenceConstants.EDITOR_MATCHING_BRACKETS; /** Preference key for matching brackets color */ private final static String MATCHING_BRACKETS_COLOR= PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR; /** Preference key for highlighting current line */ private final static String CURRENT_LINE= PreferenceConstants.EDITOR_CURRENT_LINE; /** Preference key for highlight color of current line */ private final static String CURRENT_LINE_COLOR= PreferenceConstants.EDITOR_CURRENT_LINE_COLOR; /** Preference key for showing print marging ruler */ private final static String PRINT_MARGIN= PreferenceConstants.EDITOR_PRINT_MARGIN; /** Preference key for print margin ruler color */ private final static String PRINT_MARGIN_COLOR= PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR; /** Preference key for print margin ruler column */ private final static String PRINT_MARGIN_COLUMN= PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN; /** Preference key for inserting spaces rather than tabs */ private final static String SPACES_FOR_TABS= PreferenceConstants.EDITOR_SPACES_FOR_TABS; /** Preference key for error indication */ private final static String ERROR_INDICATION= PreferenceConstants.EDITOR_PROBLEM_INDICATION; /** Preference key for error color */ private final static String ERROR_INDICATION_COLOR= PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR; /** Preference key for warning indication */ private final static String WARNING_INDICATION= PreferenceConstants.EDITOR_WARNING_INDICATION; /** Preference key for warning color */ private final static String WARNING_INDICATION_COLOR= PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR; /** Preference key for task indication */ private final static String TASK_INDICATION= PreferenceConstants.EDITOR_TASK_INDICATION; /** Preference key for task color */ private final static String TASK_INDICATION_COLOR= PreferenceConstants.EDITOR_TASK_INDICATION_COLOR; /** Preference key for bookmark indication */ private final static String BOOKMARK_INDICATION= PreferenceConstants.EDITOR_BOOKMARK_INDICATION; /** Preference key for bookmark color */ private final static String BOOKMARK_INDICATION_COLOR= PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR; /** Preference key for search result indication */ private final static String SEARCH_RESULT_INDICATION= PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION; /** Preference key for search result color */ private final static String SEARCH_RESULT_INDICATION_COLOR= PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR; /** Preference key for unknown annotation indication */ private final static String UNKNOWN_INDICATION= PreferenceConstants.EDITOR_UNKNOWN_INDICATION; /** Preference key for unknown annotation color */ private final static String UNKNOWN_INDICATION_COLOR= PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR; /** Preference key for linked position color */ private final static String LINKED_POSITION_COLOR= PreferenceConstants.EDITOR_LINKED_POSITION_COLOR; /** Preference key for shwoing the overview ruler */ private final static String OVERVIEW_RULER= PreferenceConstants.EDITOR_OVERVIEW_RULER; /** Preference key for error indication in overview ruler */ private final static String ERROR_INDICATION_IN_OVERVIEW_RULER= PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER; /** Preference key for warning indication in overview ruler */ private final static String WARNING_INDICATION_IN_OVERVIEW_RULER= PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER; /** Preference key for task indication in overview ruler */ private final static String TASK_INDICATION_IN_OVERVIEW_RULER= PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER; /** Preference key for bookmark indication in overview ruler */ private final static String BOOKMARK_INDICATION_IN_OVERVIEW_RULER= PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER; /** Preference key for search result indication in overview ruler */ private final static String SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER= PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER; /** Preference key for unknown annotation indication in overview ruler */ private final static String UNKNOWN_INDICATION_IN_OVERVIEW_RULER= PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER; /** Preference key for automatically closing strings */ private final static String CLOSE_STRINGS= PreferenceConstants.EDITOR_CLOSE_STRINGS; /** Preference key for automatically wrapping Java strings */ private final static String WRAP_STRINGS= PreferenceConstants.EDITOR_WRAP_STRINGS; /** Preference key for automatically closing brackets and parenthesis */ private final static String CLOSE_BRACKETS= PreferenceConstants.EDITOR_CLOSE_BRACKETS; /** Preference key for automatically closing javadocs and comments */ private final static String CLOSE_JAVADOCS= PreferenceConstants.EDITOR_CLOSE_JAVADOCS; /** Preference key for automatically adding javadoc tags */ private final static String ADD_JAVADOC_TAGS= PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS; /** Preference key for automatically formatting javadocs */ private final static String FORMAT_JAVADOCS= PreferenceConstants.EDITOR_FORMAT_JAVADOCS; /** Preference key for smart paste */ private final static String SMART_PASTE= PreferenceConstants.EDITOR_SMART_PASTE; private final static class AnnotationInfo { public String fColorPreference; public String fOverviewRulerPreference; public String fEditorPreference; }; private final static Map ANNOTATION_MAP; static { AnnotationInfo info; ANNOTATION_MAP= new HashMap(); info= new AnnotationInfo(); info.fColorPreference= TASK_INDICATION_COLOR; info.fOverviewRulerPreference= TASK_INDICATION_IN_OVERVIEW_RULER; info.fEditorPreference= TASK_INDICATION; ANNOTATION_MAP.put(AnnotationType.TASK, info); info= new AnnotationInfo(); info.fColorPreference= ERROR_INDICATION_COLOR; info.fOverviewRulerPreference= ERROR_INDICATION_IN_OVERVIEW_RULER; info.fEditorPreference= ERROR_INDICATION; ANNOTATION_MAP.put(AnnotationType.ERROR, info); info= new AnnotationInfo(); info.fColorPreference= WARNING_INDICATION_COLOR; info.fOverviewRulerPreference= WARNING_INDICATION_IN_OVERVIEW_RULER; info.fEditorPreference= WARNING_INDICATION; ANNOTATION_MAP.put(AnnotationType.WARNING, info); info= new AnnotationInfo(); info.fColorPreference= BOOKMARK_INDICATION_COLOR; info.fOverviewRulerPreference= BOOKMARK_INDICATION_IN_OVERVIEW_RULER; info.fEditorPreference= BOOKMARK_INDICATION; ANNOTATION_MAP.put(AnnotationType.BOOKMARK, info); info= new AnnotationInfo(); info.fColorPreference= SEARCH_RESULT_INDICATION_COLOR; info.fOverviewRulerPreference= SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER; info.fEditorPreference= SEARCH_RESULT_INDICATION; ANNOTATION_MAP.put(AnnotationType.SEARCH_RESULT, info); info= new AnnotationInfo(); info.fColorPreference= UNKNOWN_INDICATION_COLOR; info.fOverviewRulerPreference= UNKNOWN_INDICATION_IN_OVERVIEW_RULER; info.fEditorPreference= UNKNOWN_INDICATION; ANNOTATION_MAP.put(AnnotationType.UNKNOWN, info); }; private final static AnnotationType[] ANNOTATION_LAYERS= new AnnotationType[] { AnnotationType.UNKNOWN, AnnotationType.BOOKMARK, AnnotationType.TASK, AnnotationType.SEARCH_RESULT, AnnotationType.WARNING, AnnotationType.ERROR }; /** The editor's save policy */ protected ISavePolicy fSavePolicy; /** Listener to annotation model changes that updates the error tick in the tab image */ private JavaEditorErrorTickUpdater fJavaEditorErrorTickUpdater; /** The editor's paint manager */ private PaintManager fPaintManager; /** The editor's bracket painter */ private BracketPainter fBracketPainter; /** The editor's bracket matcher */ private JavaPairMatcher fBracketMatcher; /** The editor's line painter */ private LinePainter fLinePainter; /** The editor's print margin ruler painter */ private PrintMarginPainter fPrintMarginPainter; /** The editor's problem painter */ private ProblemPainter fProblemPainter; /** The editor's tab converter */ private TabConverter fTabConverter; /** History for structure select action */ private SelectionHistory fSelectionHistory; /** The preference property change listener for java core. */ private IPropertyChangeListener fPropertyChangeListener= new PropertyChangeListener(); /** The remembered java element */ private IJavaElement fRememberedElement; /** The remembered selection */ private ITextSelection fRememberedSelection; /** The remembered java element offset */ private int fRememberedElementOffset; /** The bracket inserter. */ private BracketInserter fBracketInserter= new BracketInserter(); /** The standard action groups added to the menu */ private GenerateActionGroup fGenerateActionGroup; private CompositeActionGroup fContextMenuGroup; /** * Creates a new compilation unit editor. */ public CompilationUnitEditor() { super(); setDocumentProvider(JavaPlugin.getDefault().getCompilationUnitDocumentProvider()); setEditorContextMenuId("#CompilationUnitEditorContext"); //$NON-NLS-1$ setRulerContextMenuId("#CompilationUnitRulerContext"); //$NON-NLS-1$ setOutlinerContextMenuId("#CompilationUnitOutlinerContext"); //$NON-NLS-1$ // don't set help contextId, we install our own help context fSavePolicy= null; fJavaEditorErrorTickUpdater= new JavaEditorErrorTickUpdater(this); } /* * @see AbstractTextEditor#createActions() */ protected void createActions() { super.createActions(); Action action= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "CorrectionAssistProposal.", this, JavaCorrectionSourceViewer.CORRECTIONASSIST_PROPOSALS); //$NON-NLS-1$ action.setActionDefinitionId(IJavaEditorActionDefinitionIds.CORRECTION_ASSIST_PROPOSALS); setAction("CorrectionAssistProposal", action); //$NON-NLS-1$ action= new ContentAssistAction(JavaEditorMessages.getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$ action.setActionDefinitionId(IJavaEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); setAction("ContentAssistProposal", action); //$NON-NLS-1$ action= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "ContentAssistContextInformation.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$ action.setActionDefinitionId(IJavaEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); setAction("ContentAssistContextInformation", action); //$NON-NLS-1$ action= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "Comment.", this, ITextOperationTarget.PREFIX); //$NON-NLS-1$ action.setActionDefinitionId(IJavaEditorActionDefinitionIds.COMMENT); setAction("Comment", action); //$NON-NLS-1$ action= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX); //$NON-NLS-1$ action.setActionDefinitionId(IJavaEditorActionDefinitionIds.UNCOMMENT); setAction("Uncomment", action); //$NON-NLS-1$ action= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$ action.setActionDefinitionId(IJavaEditorActionDefinitionIds.FORMAT); setAction("Format", action); //$NON-NLS-1$ action= new TextOperationAction(JavaEditorMessages.getResourceBundle(),"ShowOutline.", this, JavaCorrectionSourceViewer.SHOW_OUTLINE); //$NON-NLS-1$ action.setActionDefinitionId(IJavaEditorActionDefinitionIds.SHOW_OUTLINE); setAction(IJavaEditorActionDefinitionIds.SHOW_OUTLINE, action); action= new TextOperationAction(JavaEditorMessages.getResourceBundle(),"OpenStructure.", this, JavaCorrectionSourceViewer.OPEN_STRUCTURE); //$NON-NLS-1$ action.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_STRUCTURE); setAction(IJavaEditorActionDefinitionIds.OPEN_STRUCTURE, action); markAsStateDependentAction("CorrectionAssistProposal", true); //$NON-NLS-1$ markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$ markAsStateDependentAction("ContentAssistContextInformation", true); //$NON-NLS-1$ markAsStateDependentAction("Comment", true); //$NON-NLS-1$ markAsStateDependentAction("Uncomment", true); //$NON-NLS-1$ markAsStateDependentAction("Format", true); //$NON-NLS-1$ action= new GotoMatchingBracketAction(this); action.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_MATCHING_BRACKET); setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action); action= GoToNextPreviousMemberAction.newGoToNextMemberAction(this); action.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_NEXT_MEMBER); setAction(GoToNextPreviousMemberAction.NEXT_MEMBER, action); action= GoToNextPreviousMemberAction.newGoToPreviousMemberAction(this); action.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_PREVIOUS_MEMBER); setAction(GoToNextPreviousMemberAction.PREVIOUS_MEMBER, action); fSelectionHistory= new SelectionHistory(this); action= new StructureSelectEnclosingAction(this, fSelectionHistory); action.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_ENCLOSING); setAction(StructureSelectionAction.ENCLOSING, action); action= new StructureSelectNextAction(this, fSelectionHistory); action.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_NEXT); setAction(StructureSelectionAction.NEXT, action); action= new StructureSelectPreviousAction(this, fSelectionHistory); action.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_PREVIOUS); setAction(StructureSelectionAction.PREVIOUS, action); StructureSelectHistoryAction historyAction= new StructureSelectHistoryAction(this, fSelectionHistory); historyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_LAST); setAction(StructureSelectionAction.HISTORY, historyAction); fSelectionHistory.setHistoryAction(historyAction); fGenerateActionGroup= new GenerateActionGroup(this, ITextEditorActionConstants.GROUP_EDIT); ActionGroup rg= new RefactorActionGroup(this, ITextEditorActionConstants.GROUP_EDIT); fActionGroups.addGroup(rg); fActionGroups.addGroup(fGenerateActionGroup); // We have to keep the context menu group separate to have better control over positioning fContextMenuGroup= new CompositeActionGroup(new ActionGroup[] { fGenerateActionGroup, rg, new LocalHistoryActionGroup(this, ITextEditorActionConstants.GROUP_EDIT)}); } /* * @see JavaEditor#getElementAt(int) */ protected IJavaElement getElementAt(int offset) { return getElementAt(offset, true); } /** * Returns the most narrow element including the given offset. If <code>reconcile</code> * is <code>true</code> the editor's input element is reconciled in advance. If it is * <code>false</code> this method only returns a result if the editor's input element * does not need to be reconciled. * * @param offset the offset included by the retrieved element * @param reconcile <code>true</code> if working copy should be reconciled */ protected IJavaElement getElementAt(int offset, boolean reconcile) { IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); ICompilationUnit unit= manager.getWorkingCopy(getEditorInput()); if (unit != null) { try { if (reconcile) { synchronized (unit) { unit.reconcile(); } return unit.getElementAt(offset); } else if (unit.isConsistent()) return unit.getElementAt(offset); } catch (JavaModelException x) { JavaPlugin.log(x.getStatus()); // nothing found, be tolerant and go on } } return null; } /* * @see JavaEditor#getCorrespondingElement(IJavaElement) */ protected IJavaElement getCorrespondingElement(IJavaElement element) { try { return EditorUtility.getWorkingCopy(element, true); } catch (JavaModelException x) { JavaPlugin.log(x.getStatus()); // nothing found, be tolerant and go on } return null; } /* * @see AbstractTextEditor#editorContextMenuAboutToShow(IMenuManager) */ public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Format"); //$NON-NLS-1$ ActionContext context= new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); } /* * @see JavaEditor#setOutlinePageInput(JavaOutlinePage, IEditorInput) */ protected void setOutlinePageInput(JavaOutlinePage page, IEditorInput input) { if (page != null) { IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); page.setInput(manager.getWorkingCopy(input)); } } /* * @see AbstractTextEditor#performSaveOperation(WorkspaceModifyOperation, IProgressMonitor) */ protected void performSaveOperation(WorkspaceModifyOperation operation, IProgressMonitor progressMonitor) { IDocumentProvider p= getDocumentProvider(); if (p instanceof CompilationUnitDocumentProvider) { CompilationUnitDocumentProvider cp= (CompilationUnitDocumentProvider) p; cp.setSavePolicy(fSavePolicy); } try { super.performSaveOperation(operation, progressMonitor); } finally { if (p instanceof CompilationUnitDocumentProvider) { CompilationUnitDocumentProvider cp= (CompilationUnitDocumentProvider) p; cp.setSavePolicy(null); } } } /* * @see AbstractTextEditor#doSaveAs */ public void doSaveAs() { if (askIfNonWorkbenchEncodingIsOk()) { super.doSaveAs(); } } /* * @see AbstractTextEditor#doSave(IProgressMonitor) */ public void doSave(IProgressMonitor progressMonitor) { IDocumentProvider p= getDocumentProvider(); if (p == null) { // editor has been closed return; } if (!askIfNonWorkbenchEncodingIsOk()) { progressMonitor.setCanceled(true); return; } if (p.isDeleted(getEditorInput())) { if (isSaveAsAllowed()) { /* * 1GEUSSR: ITPUI:ALL - User should never loose changes made in the editors. * Changed Behavior to make sure that if called inside a regular save (because * of deletion of input element) there is a way to report back to the caller. */ performSaveAs(progressMonitor); } else { /* * 1GF5YOX: ITPJUI:ALL - Save of delete file claims it's still there * Missing resources. */ Shell shell= getSite().getShell(); MessageDialog.openError(shell, JavaEditorMessages.getString("CompilationUnitEditor.error.saving.title1"), JavaEditorMessages.getString("CompilationUnitEditor.error.saving.message1")); //$NON-NLS-1$ //$NON-NLS-2$ } } else { setStatusLineErrorMessage(null); IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); ICompilationUnit unit= manager.getWorkingCopy(getEditorInput()); if (unit != null) { synchronized (unit) { performSaveOperation(createSaveOperation(false), progressMonitor); } } else performSaveOperation(createSaveOperation(false), progressMonitor); } } /** * Asks the user if it is ok to store in non-workbench encoding. * @return <true> if the user wants to continue */ private boolean askIfNonWorkbenchEncodingIsOk() { IDocumentProvider provider= getDocumentProvider(); if (provider instanceof IStorageDocumentProvider) { IEditorInput input= getEditorInput(); IStorageDocumentProvider storageProvider= (IStorageDocumentProvider)provider; String encoding= storageProvider.getEncoding(input); String defaultEncoding= storageProvider.getDefaultEncoding(); if (encoding != null && !encoding.equals(defaultEncoding)) { Shell shell= getSite().getShell(); String title= JavaEditorMessages.getString("CompilationUnitEditor.warning.save.nonWorkbenchEncoding.title"); //$NON-NLS-1$ String msg; if (input != null) msg= MessageFormat.format(JavaEditorMessages.getString("CompilationUnitEditor.warning.save.nonWorkbenchEncoding.message1"), new String[] {input.getName(), encoding});//$NON-NLS-1$ else msg= MessageFormat.format(JavaEditorMessages.getString("CompilationUnitEditor.warning.save.nonWorkbenchEncoding.message2"), new String[] {encoding});//$NON-NLS-1$ return MessageDialog.openQuestion(shell, title, msg); } } return true; } /** * Jumps to the error next according to the given direction. */ public void gotoError(boolean forward) { ISelectionProvider provider= getSelectionProvider(); ITextSelection s= (ITextSelection) provider.getSelection(); Position errorPosition= new Position(0, 0); IProblemAnnotation nextError= getNextError(s.getOffset(), forward, errorPosition); if (nextError != null) { IMarker marker= null; if (nextError instanceof MarkerAnnotation) marker= ((MarkerAnnotation) nextError).getMarker(); else { Iterator e= nextError.getOverlaidIterator(); if (e != null) { while (e.hasNext()) { Object o= e.next(); if (o instanceof MarkerAnnotation) { marker= ((MarkerAnnotation) o).getMarker(); break; } } } } if (marker != null) { IWorkbenchPage page= getSite().getPage(); IViewPart view= view= page.findView("org.eclipse.ui.views.TaskList"); //$NON-NLS-1$ if (view instanceof TaskList) { StructuredSelection ss= new StructuredSelection(marker); ((TaskList) view).setSelection(ss, true); } } selectAndReveal(errorPosition.getOffset(), errorPosition.getLength()); setStatusLineErrorMessage(nextError.getMessage()); } else { setStatusLineErrorMessage(null); } } private static IRegion getSignedSelection(ITextViewer viewer) { StyledText text= viewer.getTextWidget(); int caretOffset= text.getCaretOffset(); Point selection= text.getSelection(); // caret left int offset, length; if (caretOffset == selection.x) { offset= selection.y; length= selection.x - selection.y; // caret right } else { offset= selection.x; length= selection.y - selection.x; } return new Region(offset, length); } private final static char[] BRACKETS= { '{', '}', '(', ')', '[', ']' }; private static boolean isBracket(char character) { for (int i= 0; i != BRACKETS.length; ++i) if (character == BRACKETS[i]) return true; return false; } private static boolean isSurroundedByBrackets(IDocument document, int offset) { if (offset == 0 || offset == document.getLength()) return false; try { return isBracket(document.getChar(offset - 1)) && isBracket(document.getChar(offset)); } catch (BadLocationException e) { return false; } } /** * Jumps to the matching bracket. */ public void gotoMatchingBracket() { if (fBracketMatcher == null) fBracketMatcher= new JavaPairMatcher(BRACKETS); ISourceViewer sourceViewer= getSourceViewer(); IDocument document= sourceViewer.getDocument(); if (document == null) return; IRegion selection= getSignedSelection(sourceViewer); int selectionLength= Math.abs(selection.getLength()); if (selectionLength > 1) { setStatusLineErrorMessage(JavaEditorMessages.getString("GotoMatchingBracket.error.invalidSelection")); //$NON-NLS-1$ sourceViewer.getTextWidget().getDisplay().beep(); return; } // #26314 int sourceCaretOffset= selection.getOffset() + selection.getLength(); if (isSurroundedByBrackets(document, sourceCaretOffset)) sourceCaretOffset -= selection.getLength(); IRegion region= fBracketMatcher.match(document, sourceCaretOffset); if (region == null) { setStatusLineErrorMessage(JavaEditorMessages.getString("GotoMatchingBracket.error.noMatchingBracket")); //$NON-NLS-1$ sourceViewer.getTextWidget().getDisplay().beep(); return; } int offset= region.getOffset(); int length= region.getLength(); if (length < 1) return; int anchor= fBracketMatcher.getAnchor(); int targetOffset= (JavaPairMatcher.RIGHT == anchor) ? offset : offset + length - 1; boolean visible= false; if (sourceViewer instanceof ITextViewerExtension3) { ITextViewerExtension3 extension= (ITextViewerExtension3) sourceViewer; visible= (extension.modelOffset2WidgetOffset(targetOffset) > -1); } else { IRegion visibleRegion= sourceViewer.getVisibleRegion(); visible= (targetOffset >= visibleRegion.getOffset() && targetOffset < visibleRegion.getOffset() + visibleRegion.getLength()); } if (!visible) { setStatusLineErrorMessage(JavaEditorMessages.getString("GotoMatchingBracket.error.bracketOutsideSelectedElement")); //$NON-NLS-1$ sourceViewer.getTextWidget().getDisplay().beep(); return; } if (selection.getLength() < 0) targetOffset -= selection.getLength(); sourceViewer.setSelectedRange(targetOffset, selection.getLength()); sourceViewer.revealRange(targetOffset, selection.getLength()); } /** * Ses the given message as error message to this editor's status line. * @param msg message to be set */ protected void setStatusLineErrorMessage(String msg) { IEditorStatusLine statusLine= (IEditorStatusLine) getAdapter(IEditorStatusLine.class); if (statusLine != null) statusLine.setMessage(true, msg, null); } private IProblemAnnotation getNextError(int offset, boolean forward, Position errorPosition) { IProblemAnnotation nextError= null; Position nextErrorPosition= null; IDocument document= getDocumentProvider().getDocument(getEditorInput()); int endOfDocument= document.getLength(); int distance= 0; IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput()); Iterator e= new ProblemAnnotationIterator(model, false); while (e.hasNext()) { IProblemAnnotation a= (IProblemAnnotation) e.next(); if (a.hasOverlay() || !a.isProblem()) continue; Position p= model.getPosition((Annotation) a); if (!p.includes(offset)) { int currentDistance= 0; if (forward) { currentDistance= p.getOffset() - offset; if (currentDistance < 0) currentDistance= endOfDocument - offset + p.getOffset(); } else { currentDistance= offset - p.getOffset(); if (currentDistance < 0) currentDistance= offset + endOfDocument - p.getOffset(); } if (nextError == null || currentDistance < distance) { distance= currentDistance; nextError= a; nextErrorPosition= p; } } } if (nextErrorPosition != null) { errorPosition.setOffset(nextErrorPosition.getOffset()); errorPosition.setLength(nextErrorPosition.getLength()); } return nextError; } /* * @see AbstractTextEditor#isSaveAsAllowed() */ public boolean isSaveAsAllowed() { return true; } /** * The compilation unit editor implementation of this <code>AbstractTextEditor</code> * method asks the user for the workspace path of a file resource and saves the document * there. See http://dev.eclipse.org/bugs/show_bug.cgi?id=6295 */ protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell= getSite().getShell(); IEditorInput input = getEditorInput(); SaveAsDialog dialog= new SaveAsDialog(shell); IFile original= (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile() : null; if (original != null) dialog.setOriginalFile(original); dialog.create(); IDocumentProvider provider= getDocumentProvider(); if (provider == null) { // editor has been programmatically closed while the dialog was open return; } if (provider.isDeleted(input) && original != null) { String message= JavaEditorMessages.getFormattedString("CompilationUnitEditor.warning.save.delete", new Object[] { original.getName() }); //$NON-NLS-1$ dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } if (dialog.open() == Dialog.CANCEL) { if (progressMonitor != null) progressMonitor.setCanceled(true); return; } IPath filePath= dialog.getResult(); if (filePath == null) { if (progressMonitor != null) progressMonitor.setCanceled(true); return; } IWorkspace workspace= ResourcesPlugin.getWorkspace(); IFile file= workspace.getRoot().getFile(filePath); final IEditorInput newInput= new FileEditorInput(file); WorkspaceModifyOperation op= new WorkspaceModifyOperation() { public void execute(final IProgressMonitor monitor) throws CoreException { getDocumentProvider().saveDocument(monitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true); } }; boolean success= false; try { provider.aboutToChange(newInput); new ProgressMonitorDialog(shell).run(false, true, op); success= true; } catch (InterruptedException x) { } catch (InvocationTargetException x) { Throwable t= x.getTargetException(); if (t instanceof CoreException) { CoreException cx= (CoreException) t; ErrorDialog.openError(shell, JavaEditorMessages.getString("CompilationUnitEditor.error.saving.title2"), JavaEditorMessages.getString("CompilationUnitEditor.error.saving.message2"), cx.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$ } else { MessageDialog.openError(shell, JavaEditorMessages.getString("CompilationUnitEditor.error.saving.title3"), JavaEditorMessages.getString("CompilationUnitEditor.error.saving.message3") + t.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ } } finally { provider.changed(newInput); if (success) setInput(newInput); } if (progressMonitor != null) progressMonitor.setCanceled(!success); } /* * @see AbstractTextEditor#doSetInput(IEditorInput) */ protected void doSetInput(IEditorInput input) throws CoreException { super.doSetInput(input); configureTabConverter(); } private void startBracketHighlighting() { if (fBracketPainter == null) { ISourceViewer sourceViewer= getSourceViewer(); fBracketPainter= new BracketPainter(sourceViewer); fBracketPainter.setHighlightColor(getColor(MATCHING_BRACKETS_COLOR)); fPaintManager.addPainter(fBracketPainter); } } private void stopBracketHighlighting() { if (fBracketPainter != null) { fPaintManager.removePainter(fBracketPainter); fBracketPainter.deactivate(true); fBracketPainter.dispose(); fBracketPainter= null; } } private boolean isBracketHighlightingEnabled() { IPreferenceStore store= getPreferenceStore(); return store.getBoolean(MATCHING_BRACKETS); } private void startLineHighlighting() { if (fLinePainter == null) { ISourceViewer sourceViewer= getSourceViewer(); fLinePainter= new LinePainter(sourceViewer); fLinePainter.setHighlightColor(getColor(CURRENT_LINE_COLOR)); fPaintManager.addPainter(fLinePainter); } } private void stopLineHighlighting() { if (fLinePainter != null) { fPaintManager.removePainter(fLinePainter); fLinePainter.deactivate(true); fLinePainter.dispose(); fLinePainter= null; } } private boolean isLineHighlightingEnabled() { IPreferenceStore store= getPreferenceStore(); return store.getBoolean(CURRENT_LINE); } private void showPrintMargin() { if (fPrintMarginPainter == null) { fPrintMarginPainter= new PrintMarginPainter(getSourceViewer()); fPrintMarginPainter.setMarginRulerColor(getColor(PRINT_MARGIN_COLOR)); fPrintMarginPainter.setMarginRulerColumn(getPreferenceStore().getInt(PRINT_MARGIN_COLUMN)); fPaintManager.addPainter(fPrintMarginPainter); } } private void hidePrintMargin() { if (fPrintMarginPainter != null) { fPaintManager.removePainter(fPrintMarginPainter); fPrintMarginPainter.deactivate(true); fPrintMarginPainter.dispose(); fPrintMarginPainter= null; } } private boolean isPrintMarginVisible() { IPreferenceStore store= getPreferenceStore(); return store.getBoolean(PRINT_MARGIN); } private void startAnnotationIndication(AnnotationType annotationType) { if (fProblemPainter == null) { fProblemPainter= new ProblemPainter(this, getSourceViewer()); fPaintManager.addPainter(fProblemPainter); } fProblemPainter.setColor(annotationType, getColor(annotationType)); fProblemPainter.paintAnnotations(annotationType, true); fProblemPainter.paint(IPainter.CONFIGURATION); } private void shutdownAnnotationIndication() { if (fProblemPainter != null) { if (!fProblemPainter.isPaintingAnnotations()) { fPaintManager.removePainter(fProblemPainter); fProblemPainter.deactivate(true); fProblemPainter.dispose(); fProblemPainter= null; } else { fProblemPainter.paint(IPainter.CONFIGURATION); } } } private void stopAnnotationIndication(AnnotationType annotationType) { if (fProblemPainter != null) { fProblemPainter.paintAnnotations(annotationType, false); shutdownAnnotationIndication(); } } private boolean isAnnotationIndicationEnabled(AnnotationType annotationType) { IPreferenceStore store= getPreferenceStore(); AnnotationInfo info= (AnnotationInfo) ANNOTATION_MAP.get(annotationType); if (info != null) return store.getBoolean(info.fEditorPreference); return false; } private boolean isAnnotationIndicationInOverviewRulerEnabled(AnnotationType annotationType) { IPreferenceStore store= getPreferenceStore(); AnnotationInfo info= (AnnotationInfo) ANNOTATION_MAP.get(annotationType); if (info != null) return store.getBoolean(info.fOverviewRulerPreference); return false; } private void showAnnotationIndicationInOverviewRuler(AnnotationType annotationType, boolean show) { AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); OverviewRuler ruler= asv.getOverviewRuler(); if (ruler != null) { ruler.setColor(annotationType, getColor(annotationType)); ruler.showAnnotation(annotationType, show); ruler.update(); } } private void setColorInOverviewRuler(AnnotationType annotationType, Color color) { AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); OverviewRuler ruler= asv.getOverviewRuler(); if (ruler != null) { ruler.setColor(annotationType, color); ruler.update(); } } private void configureTabConverter() { if (fTabConverter != null) { IDocumentProvider provider= getDocumentProvider(); if (provider instanceof CompilationUnitDocumentProvider) { CompilationUnitDocumentProvider cup= (CompilationUnitDocumentProvider) provider; fTabConverter.setLineTracker(cup.createLineTracker(getEditorInput())); } } } private int getTabSize() { Preferences preferences= JavaCore.getPlugin().getPluginPreferences(); return preferences.getInt(CODE_FORMATTER_TAB_SIZE); } private void startTabConversion() { if (fTabConverter == null) { fTabConverter= new TabConverter(); configureTabConverter(); fTabConverter.setNumberOfSpacesPerTab(getTabSize()); AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); asv.addTextConverter(fTabConverter); // http://dev.eclipse.org/bugs/show_bug.cgi?id=19270 asv.updateIndentationPrefixes(); } } private void stopTabConversion() { if (fTabConverter != null) { AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); asv.removeTextConverter(fTabConverter); // http://dev.eclipse.org/bugs/show_bug.cgi?id=19270 asv.updateIndentationPrefixes(); fTabConverter= null; } } private boolean isTabConversionEnabled() { IPreferenceStore store= getPreferenceStore(); return store.getBoolean(SPACES_FOR_TABS); } private void showOverviewRuler() { AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); asv.showOverviewRuler(); OverviewRuler overviewRuler= asv.getOverviewRuler(); if (overviewRuler != null) { for (int i= 0; i < ANNOTATION_LAYERS.length; i++) { AnnotationType type= ANNOTATION_LAYERS[i]; overviewRuler.setLayer(type, i); if (isAnnotationIndicationInOverviewRulerEnabled(type)) showAnnotationIndicationInOverviewRuler(type, true); } } } private void hideOverviewRuler() { AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); asv.hideOverviewRuler(); } private boolean isOverviewRulerVisible() { IPreferenceStore store= getPreferenceStore(); return store.getBoolean(OVERVIEW_RULER); } private Color getColor(String key) { RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), key); return getColor(rgb); } private Color getColor(RGB rgb) { JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools(); return textTools.getColorManager().getColor(rgb); } private Color getColor(AnnotationType annotationType) { AnnotationInfo info= (AnnotationInfo) ANNOTATION_MAP.get(annotationType); if (info != null) return getColor(info.fColorPreference); return null; } /* * @see AbstractTextEditor#dispose() */ public void dispose() { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer instanceof ITextViewerExtension) ((ITextViewerExtension) sourceViewer).removeVerifyKeyListener(fBracketInserter); if (fPropertyChangeListener != null) { Preferences preferences= JavaCore.getPlugin().getPluginPreferences(); preferences.removePropertyChangeListener(fPropertyChangeListener); fPropertyChangeListener= null; } if (fJavaEditorErrorTickUpdater != null) { fJavaEditorErrorTickUpdater.dispose(); fJavaEditorErrorTickUpdater= null; } if (fSelectionHistory != null) fSelectionHistory.dispose(); if (fPaintManager != null) { fPaintManager.dispose(); fPaintManager= null; } if (fActionGroups != null) fActionGroups.dispose(); super.dispose(); } /* * @see AbstractTextEditor#createPartControl(Composite) */ public void createPartControl(Composite parent) { super.createPartControl(parent); fPaintManager= new PaintManager(getSourceViewer()); if (isBracketHighlightingEnabled()) startBracketHighlighting(); if (isLineHighlightingEnabled()) startLineHighlighting(); if (isPrintMarginVisible()) showPrintMargin(); Iterator e= ANNOTATION_MAP.keySet().iterator(); while (e.hasNext()) { AnnotationType type= (AnnotationType) e.next(); if (isAnnotationIndicationEnabled(type)) startAnnotationIndication(type); } if (isTabConversionEnabled()) startTabConversion(); if (isOverviewRulerVisible()) showOverviewRuler(); Preferences preferences= JavaCore.getPlugin().getPluginPreferences(); preferences.addPropertyChangeListener(fPropertyChangeListener); IPreferenceStore preferenceStore= getPreferenceStore(); boolean closeBrackets= preferenceStore.getBoolean(CLOSE_BRACKETS); boolean closeStrings= preferenceStore.getBoolean(CLOSE_STRINGS); fBracketInserter.setCloseBracketsEnabled(closeBrackets); fBracketInserter.setCloseStringsEnabled(closeStrings); ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer instanceof ITextViewerExtension) ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter); } private static char getPeerCharacter(char character) { switch (character) { case '(': return ')'; case ')': return '('; case '[': return ']'; case ']': return '['; case '"': return character; default: throw new IllegalArgumentException(); } } private static class ExitPolicy implements LinkedPositionUI.ExitPolicy { final char fExitCharacter; public ExitPolicy(char exitCharacter) { fExitCharacter= exitCharacter; } /* * @see org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.ExitPolicy#doExit(org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager, org.eclipse.swt.events.VerifyEvent, int, int) */ public ExitFlags doExit(LinkedPositionManager manager, VerifyEvent event, int offset, int length) { if (event.character == fExitCharacter) { if (manager.anyPositionIncludes(offset, length)) return new ExitFlags(LinkedPositionUI.COMMIT| LinkedPositionUI.UPDATE_CARET, false); else return new ExitFlags(LinkedPositionUI.COMMIT, true); } switch (event.character) { case '\b': if (manager.getFirstPosition().length == 0) return new ExitFlags(0, false); else return null; case '\n': case '\r': return new ExitFlags(LinkedPositionUI.COMMIT, true); default: return null; } } } private class BracketInserter implements VerifyKeyListener, LinkedPositionUI.ExitListener { private boolean fCloseBrackets= true; private boolean fCloseStrings= true; private int fOffset; private int fLength; public void setCloseBracketsEnabled(boolean enabled) { fCloseBrackets= enabled; } public void setCloseStringsEnabled(boolean enabled) { fCloseStrings= enabled; } private boolean hasIdentifierToTheRight(IDocument document, int offset) { try { int end= offset; IRegion endLine= document.getLineInformationOfOffset(end); int maxEnd= endLine.getOffset() + endLine.getLength(); while (end != maxEnd && Character.isWhitespace(document.getChar(end))) ++end; return end != maxEnd && Character.isJavaIdentifierPart(document.getChar(end)); } catch (BadLocationException e) { // be conservative return true; } } private boolean hasIdentifierToTheLeft(IDocument document, int offset) { try { int start= offset; IRegion startLine= document.getLineInformationOfOffset(start); int minStart= startLine.getOffset(); while (start != minStart && Character.isWhitespace(document.getChar(start - 1))) --start; return start != minStart && Character.isJavaIdentifierPart(document.getChar(start - 1)); } catch (BadLocationException e) { return true; } } private boolean hasCharacterToTheRight(IDocument document, int offset, char character) { try { int end= offset; IRegion endLine= document.getLineInformationOfOffset(end); int maxEnd= endLine.getOffset() + endLine.getLength(); while (end != maxEnd && Character.isWhitespace(document.getChar(end))) ++end; return end != maxEnd && document.getChar(end) == character; } catch (BadLocationException e) { // be conservative return true; } } /* * @see org.eclipse.swt.custom.VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent) */ public void verifyKey(VerifyEvent event) { if (!event.doit) return; final ISourceViewer sourceViewer= getSourceViewer(); IDocument document= sourceViewer.getDocument(); final Point selection= sourceViewer.getSelectedRange(); final int offset= selection.x; final int length= selection.y; switch (event.character) { case '(': if (hasCharacterToTheRight(document, offset + length, '(')) return; // fall through case '[': if (!fCloseBrackets) return; if (hasIdentifierToTheRight(document, offset + length)) return; // fall through case '"': if (event.character == '"') { if (!fCloseStrings) return; if (hasIdentifierToTheLeft(document, offset) || hasIdentifierToTheRight(document, offset + length)) return; } try { ITypedRegion partition= document.getPartition(offset); if (! IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType()) && partition.getOffset() != offset) return; final char character= event.character; final char closingCharacter= getPeerCharacter(character); final StringBuffer buffer= new StringBuffer(); buffer.append(character); buffer.append(closingCharacter); document.replace(offset, length, buffer.toString()); LinkedPositionManager manager= new LinkedPositionManager(document); manager.addPosition(offset + 1, 0); fOffset= offset; fLength= 2; LinkedPositionUI editor= new LinkedPositionUI(sourceViewer, manager); editor.setCancelListener(this); editor.setExitPolicy(new ExitPolicy(closingCharacter)); editor.setFinalCaretOffset(offset + 2); editor.enter(); IRegion newSelection= editor.getSelectedRegion(); sourceViewer.setSelectedRange(newSelection.getOffset(), newSelection.getLength()); event.doit= false; } catch (BadLocationException e) { } break; } } /* * @see org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.ExitListener#exit(boolean) */ public void exit(boolean accept) { if (accept) return; // remove brackets try { final ISourceViewer sourceViewer= getSourceViewer(); IDocument document= sourceViewer.getDocument(); document.replace(fOffset, fLength, null); } catch (BadLocationException e) { } } } protected AnnotationType getAnnotationType(String preferenceKey) { Iterator e= ANNOTATION_MAP.keySet().iterator(); while (e.hasNext()) { AnnotationType type= (AnnotationType) e.next(); AnnotationInfo info= (AnnotationInfo) ANNOTATION_MAP.get(type); if (info != null) { if (preferenceKey.equals(info.fColorPreference) || preferenceKey.equals(info.fEditorPreference) || preferenceKey.equals(info.fOverviewRulerPreference)) return type; } } return null; } /* * @see AbstractTextEditor#handlePreferenceStoreChanged(PropertyChangeEvent) */ protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { try { AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); if (asv != null) { String p= event.getProperty(); if (CLOSE_BRACKETS.equals(p)) { fBracketInserter.setCloseBracketsEnabled(getPreferenceStore().getBoolean(p)); return; } if (CLOSE_STRINGS.equals(p)) { fBracketInserter.setCloseStringsEnabled(getPreferenceStore().getBoolean(p)); return; } if (SPACES_FOR_TABS.equals(p)) { if (isTabConversionEnabled()) startTabConversion(); else stopTabConversion(); return; } if (MATCHING_BRACKETS.equals(p)) { if (isBracketHighlightingEnabled()) startBracketHighlighting(); else stopBracketHighlighting(); return; } if (MATCHING_BRACKETS_COLOR.equals(p)) { if (fBracketPainter != null) fBracketPainter.setHighlightColor(getColor(MATCHING_BRACKETS_COLOR)); return; } if (CURRENT_LINE.equals(p)) { if (isLineHighlightingEnabled()) startLineHighlighting(); else stopLineHighlighting(); return; } if (CURRENT_LINE_COLOR.equals(p)) { if (fLinePainter != null) { stopLineHighlighting(); startLineHighlighting(); } return; } if (PRINT_MARGIN.equals(p)) { if (isPrintMarginVisible()) showPrintMargin(); else hidePrintMargin(); return; } if (PRINT_MARGIN_COLOR.equals(p)) { if (fPrintMarginPainter != null) fPrintMarginPainter.setMarginRulerColor(getColor(PRINT_MARGIN_COLOR)); return; } if (PRINT_MARGIN_COLUMN.equals(p)) { if (fPrintMarginPainter != null) fPrintMarginPainter.setMarginRulerColumn(getPreferenceStore().getInt(PRINT_MARGIN_COLUMN)); return; } if (OVERVIEW_RULER.equals(p)) { if (isOverviewRulerVisible()) showOverviewRuler(); else hideOverviewRuler(); return; } AnnotationType type= getAnnotationType(p); if (type != null) { AnnotationInfo info= (AnnotationInfo) ANNOTATION_MAP.get(type); if (info.fColorPreference.equals(p)) { Color color= getColor(type); if (fProblemPainter != null) { fProblemPainter.setColor(type, color); fProblemPainter.paint(IPainter.CONFIGURATION); } setColorInOverviewRuler(type, color); return; } if (info.fEditorPreference.equals(p)) { if (isAnnotationIndicationEnabled(type)) startAnnotationIndication(type); else stopAnnotationIndication(type); return; } if (info.fOverviewRulerPreference.equals(p)) { if (isAnnotationIndicationInOverviewRulerEnabled(type)) showAnnotationIndicationInOverviewRuler(type, true); else showAnnotationIndicationInOverviewRuler(type, false); return; } } IContentAssistant c= asv.getContentAssistant(); if (c instanceof ContentAssistant) ContentAssistPreference.changeConfiguration((ContentAssistant) c, getPreferenceStore(), event); } } finally { super.handlePreferenceStoreChanged(event); } } /** * Handles a property change event describing a change * of the java core's preferences and updates the preference * related editor properties. * * @param event the property change event */ protected void handlePreferencePropertyChanged(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) { AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); if (asv != null) { String p= event.getProperty(); if (CODE_FORMATTER_TAB_SIZE.equals(p)) { asv.updateIndentationPrefixes(); if (fTabConverter != null) fTabConverter.setNumberOfSpacesPerTab(getTabSize()); } } } /* * @see AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent) */ protected boolean affectsTextPresentation(PropertyChangeEvent event) { String p= event.getProperty(); boolean affects=MATCHING_BRACKETS_COLOR.equals(p) || CURRENT_LINE_COLOR.equals(p) || ERROR_INDICATION_COLOR.equals(p) || WARNING_INDICATION_COLOR.equals(p) || TASK_INDICATION_COLOR.equals(p); return affects ? affects : super.affectsTextPresentation(event); } /* * @see JavaEditor#createJavaSourceViewer(Composite, IVerticalRuler, int) */ protected ISourceViewer createJavaSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { return new AdaptedSourceViewer(parent, ruler, styles); } /* * @see JavaEditor#synchronizeOutlinePageSelection() */ public void synchronizeOutlinePageSelection() { if (isEditingScriptRunning()) return; ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null || fOutlinePage == null) return; StyledText styledText= sourceViewer.getTextWidget(); if (styledText == null) return; int modelCaret= 0; if (sourceViewer instanceof ITextViewerExtension3) { ITextViewerExtension3 extension= (ITextViewerExtension3) sourceViewer; modelCaret= extension.widgetOffset2ModelOffset(styledText.getCaretOffset()); } else { int offset= sourceViewer.getVisibleRegion().getOffset(); modelCaret= offset + styledText.getCaretOffset(); } IJavaElement element= getElementAt(modelCaret, false); ISourceReference reference= getSourceReference(element, modelCaret); if (reference != null) { fOutlinePage.removeSelectionChangedListener(fSelectionChangedListener); fOutlinePage.select(reference); fOutlinePage.addSelectionChangedListener(fSelectionChangedListener); } } private ISourceReference getSourceReference(IJavaElement element, int offset) { if ( !(element instanceof ISourceReference)) return null; if (element.getElementType() == IJavaElement.IMPORT_DECLARATION) { IImportDeclaration declaration= (IImportDeclaration) element; IImportContainer container= (IImportContainer) declaration.getParent(); ISourceRange srcRange= null; try { srcRange= container.getSourceRange(); } catch (JavaModelException e) { } if (srcRange != null && srcRange.getOffset() == offset) return container; } return (ISourceReference) element; } /* * @see IReconcilingParticipant#reconciled() */ public void reconciled() { if (!JavaEditorPreferencePage.synchronizeOutlineOnCursorMove()) { Shell shell= getSite().getShell(); if (shell != null && !shell.isDisposed()) { shell.getDisplay().asyncExec(new Runnable() { public void run() { synchronizeOutlinePageSelection(); } }); } } } protected void updateStateDependentActions() { super.updateStateDependentActions(); fGenerateActionGroup.editorStateChanged(); } /** * Returns the updated java element for the old java element. */ private IJavaElement findElement(IJavaElement element) { if (element == null) return null; IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); ICompilationUnit unit= manager.getWorkingCopy(getEditorInput()); if (unit != null) { try { synchronized (unit) { unit.reconcile(); } IJavaElement[] findings= unit.findElements(element); if (findings != null && findings.length > 0) return findings[0]; } catch (JavaModelException x) { JavaPlugin.log(x.getStatus()); // nothing found, be tolerant and go on } } return null; } /** * Returns the offset of the given Java element. */ private int getOffset(IJavaElement element) { if (element instanceof ISourceReference) { ISourceReference sr= (ISourceReference) element; try { ISourceRange srcRange= sr.getSourceRange(); if (srcRange != null) return srcRange.getOffset(); } catch (JavaModelException e) { } } return -1; } /* * @see AbstractTextEditor#rememberSelection() */ protected void rememberSelection() { ISelectionProvider sp= getSelectionProvider(); fRememberedSelection= (sp == null ? null : (ITextSelection) sp.getSelection()); if (fRememberedSelection != null) { fRememberedElement= getElementAt(fRememberedSelection.getOffset(), true); fRememberedElementOffset= getOffset(fRememberedElement); } } /* * @see AbstractTextEditor#restoreSelection() */ protected void restoreSelection() { try { if (getSourceViewer() == null || fRememberedSelection == null) return; IJavaElement newElement= findElement(fRememberedElement); int newOffset= getOffset(newElement); int delta= (newOffset > -1 && fRememberedElementOffset > -1) ? newOffset - fRememberedElementOffset : 0; if (isValidSelection(delta + fRememberedSelection.getOffset(), fRememberedSelection.getLength())) selectAndReveal(delta + fRememberedSelection.getOffset(), fRememberedSelection.getLength()); } finally { fRememberedSelection= null; fRememberedElement= null; fRememberedElementOffset= -1; } } private boolean isValidSelection(int offset, int length) { IDocumentProvider provider= getDocumentProvider(); if (provider != null) { IDocument document= provider.getDocument(getEditorInput()); if (document != null) { int end= offset + length; int documentLength= document.getLength(); return 0 <= offset && offset <= documentLength && 0 <= end && end <= documentLength; } } return false; } /* * @see AbstractTextEditor#canHandleMove(IEditorInput, IEditorInput) */ protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) { String oldExtension= ""; //$NON-NLS-1$ if (originalElement instanceof IFileEditorInput) { IFile file= ((IFileEditorInput) originalElement).getFile(); if (file != null) { String ext= file.getFileExtension(); if (ext != null) oldExtension= ext; } } String newExtension= ""; //$NON-NLS-1$ if (movedElement instanceof IFileEditorInput) { IFile file= ((IFileEditorInput) movedElement).getFile(); if (file != null) newExtension= file.getFileExtension(); } return oldExtension.equals(newExtension); } }
28,602
Bug 28602 On Eclipse startup: No disk in drive dialog pops up [ccp]
20021217 win 2000 1. Insert a disk in the floppy drive, for the file explorer select a file and copy to clipboard. 2. remove the floppy disk. start eclipse while booting you suddently get a dialog: 'There is no disk in the drive. Please insert a disk into drive A:' Get a stack trace usning CTRL + BREAK: PasteResourcesFromClipboardAction is the cause. This looks also like a performance issue. (E.g. if could take minutes if the drive is a network drive that is disconnected) at java.io.Win32FileSystem.getBooleanAttributes(Native Method) at java.io.File.exists(File.java:562) at org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.allFilesExis t(PasteResourcesFromClipboardAction.java:145) at org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.canPasteFile s(PasteResourcesFromClipboardAction.java:154) at org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.canOperateOn (PasteResourcesFromClipboardAction.java:106) at org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.selectionCha nged(PasteResourcesFromClipboardAction.java:48) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged (SelectionDispatchAction.java:181) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged (SelectionDispatchAction.java:176) at org.eclipse.jdt.internal.ui.reorg.DualReorgAction.selectionChanged (DualReorgAction.java:40) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged (Viewer.java:148) at org.eclipse.jface.viewers.StructuredViewer.updateSelection (StructuredViewer.java:1151) at org.eclipse.jface.viewers.StructuredViewer.setSelection (StructuredViewer.java:900) at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:343) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.restoreSelectionStat e(PackageExplorerPart.java:804) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.restoreUIState (PackageExplorerPart.java:763) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.createPartControl (PackageExplorerPart.java:306) at org.eclipse.ui.internal.PartPane$4.run(PartPane.java:135) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:852) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.ui.internal.PartPane.createChildControl (PartPane.java:133) at org.eclipse.ui.internal.ViewPane.createChildControl (ViewPane.java:202) at org.eclipse.ui.internal.PartPane.createControl(PartPane.java:177) at org.eclipse.ui.internal.ViewPane.createControl(ViewPane.java:181) at org.eclipse.ui.internal.PartTabFolder.createPartTab (PartTabFolder.java:251) at org.eclipse.ui.internal.PartTabFolder.createControl (PartTabFolder.java:223) at org.eclipse.ui.internal.PartSashContainer.createControl (PartSashContainer.java:181) at org.eclipse.ui.internal.PerspectivePresentation.activate (PerspectivePresentation.java:94) at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:665) at org.eclipse.ui.internal.WorkbenchPage.onActivate (WorkbenchPage.java:1633) at org.eclipse.ui.internal.WorkbenchWindow$7.run (WorkbenchWindow.java:1283) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65) at org.eclipse.ui.internal.WorkbenchWindow.setActivePage (WorkbenchWindow.java:1270) at org.eclipse.ui.internal.WorkbenchWindow.restoreState (WorkbenchWindow.java:1153) at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1300) at org.eclipse.ui.internal.Workbench.access$9(Workbench.java:1269) at org.eclipse.ui.internal.Workbench$10.run(Workbench.java:923) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:852) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.ui.internal.Workbench.openPreviousWorkbenchState (Workbench.java:875) at org.eclipse.ui.internal.Workbench.init(Workbench.java:675) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1422) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
resolved fixed
ce21aef
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T11:13:49Z
2002-12-18T11:13:20Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/reorg/PasteResourcesFromClipboardAction.java
package org.eclipse.jdt.internal.ui.reorg; import java.io.File; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.actions.CopyFilesAndFoldersOperation; import org.eclipse.ui.actions.CopyProjectAction; import org.eclipse.ui.part.ResourceTransfer; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.actions.SelectionDispatchAction; import org.eclipse.jdt.internal.corext.Assert; import org.eclipse.jdt.internal.corext.refactoring.reorg.CopyRefactoring; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; public class PasteResourcesFromClipboardAction extends SelectionDispatchAction { private Clipboard fClipboard; protected PasteResourcesFromClipboardAction(IWorkbenchSite site, Clipboard clipboard) { super(site); Assert.isNotNull(clipboard); fClipboard= clipboard; } /* * @see SelectionDispatchAction#selectionChanged(IStructuredSelection) */ protected void selectionChanged(IStructuredSelection selection) { setEnabled(canOperateOn(selection)); } /* * @see SelectionDispatchAction#run(IStructuredSelection) */ public void run(IStructuredSelection selection) { IResource[] resourceData = getClipboardResources(); if (resourceData == null || resourceData.length == 0){ if (canPasteFiles(selection)) pasteFiles(selection.getFirstElement()); return; } pasteResources(selection, resourceData); } private void pasteFiles(Object target) { String[] fileData= getClipboardFiles(); if (fileData == null) return; IContainer container= convertToContainer(target); if (container == null) return; new CopyFilesAndFoldersOperation(getShell()).copyFiles(fileData, container); } private IContainer convertToContainer(Object target){ if (target instanceof IContainer) return (IContainer)target; try { return (IContainer)((IJavaElement)target).getCorrespondingResource(); } catch (JavaModelException e) { ExceptionHandler.handle(e, ReorgMessages.getString("PasteResourcesFromClipboardAction.error.title"), ReorgMessages.getString("PasteResourcesFromClipboardAction.error.message")); //$NON-NLS-1$ //$NON-NLS-2$ return null; } } private void pasteResources(IStructuredSelection selection, IResource[] resourceData) { if (resourceData[0].getType() == IResource.PROJECT) pasteProject((IProject) resourceData[0]); else ReorgActionFactory.createDnDCopyAction(resourceData, getFirstSelectedResource(selection)).run(); } private void pasteProject(IProject project){ CopyProjectAction cpa= new CopyProjectAction(getShell()); cpa.selectionChanged(new StructuredSelection(project)); if (! cpa.isEnabled()) return; cpa.run(); } //- enablement --- private boolean canOperateOn(IStructuredSelection selection){ IResource[] resourceData= getClipboardResources(); if (resourceData == null || resourceData.length == 0) return canPasteFiles(selection); if (ClipboardActionUtil.isOneOpenProject(resourceData)) return true; if (selection.size() != 1) //only after we checked the 'one project' case return false; /* * special case: if both source references and resources are in clipboard - disable this action * if a compilation unit is selected. * this is important in the case when a type is copied to the clipboard - we put also its compilation unit */ TypedSource[] typedSource= getClipboardSourceReference(); if (selection.getFirstElement() instanceof ICompilationUnit && typedSource != null && typedSource.length != 0) return false; if (StructuredSelectionUtil.getResources(selection).length != 1) return false; if (resourceData == null) return ClipboardActionUtil.getFirstResource(selection) instanceof IContainer; if (! allResourcesExist(resourceData)) return false; return canActivateCopyRefactoring(resourceData, ClipboardActionUtil.getFirstResource(selection)); } private static boolean allResourcesExist(IResource[] resourceData) { for (int i= 0; i < resourceData.length; i++) { if (! resourceData[i].exists()) return false; } return true; } private static boolean allFilesExist(String[] clipboardFiles) { for (int i= 0; i < clipboardFiles.length; i++) { if (! new File(clipboardFiles[i]).exists()) return false; } return true; } private boolean canPasteFiles(IStructuredSelection selection) { String[] clipboardFiles= getClipboardFiles(); return clipboardFiles != null && allFilesExist(clipboardFiles) && canPasteFilesOn(selection.getFirstElement()); } private static boolean canPasteFilesOn(Object target) { boolean isPackageFragment= target instanceof IPackageFragment; boolean isJavaProject= target instanceof IJavaProject; boolean isPackageFragmentRoot= target instanceof IPackageFragmentRoot; boolean isContainer= target instanceof IContainer; if (!(isPackageFragment || isJavaProject || isPackageFragmentRoot || isContainer)) return false; if (isContainer) { IContainer container= (IContainer)target; if (!container.isReadOnly()) return true; } else { IJavaElement element= (IJavaElement)target; if (!element.isReadOnly()) return true; } return false; } private static boolean canActivateCopyRefactoring(IResource[] resourceData, IResource selectedResource) { try{ CopyRefactoring ref= createCopyRefactoring(resourceData); if (! ref.checkActivation(new NullProgressMonitor()).isOK()) return false; return ref.isValidDestination(ClipboardActionUtil.tryConvertingToJava(selectedResource)); } catch (JavaModelException e){ return false; } } //-- helpers private IResource getFirstSelectedResource(IStructuredSelection selection){ return ClipboardActionUtil.getFirstResource(selection); } private String[] getClipboardFiles() { return ((String[])fClipboard.getContents(FileTransfer.getInstance())); } private IResource[] getClipboardResources() { return ((IResource[])fClipboard.getContents(ResourceTransfer.getInstance())); } private TypedSource[] getClipboardSourceReference() { return ((TypedSource[])fClipboard.getContents(TypedSourceTransfer.getInstance())); } private static CopyRefactoring createCopyRefactoring(IResource[] resourceData) { return new CopyRefactoring(ClipboardActionUtil.getConvertedResources(resourceData), new CopyQueries()); } }
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
org.eclipse.jdt.ui/ui
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/PerformChangeOperation.java
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
org.eclipse.jdt.ui/ui
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/RefactoringExecutionHelper.java
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
org.eclipse.jdt.ui/ui
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/actions/InlineMethodAction.java
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.ui; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdapterManager; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.ui.IContextMenuConstants; import org.eclipse.jdt.ui.IWorkingCopyManager; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.ui.text.JavaTextTools; import org.eclipse.jdt.internal.corext.javadoc.JavaDocLocations; import org.eclipse.jdt.internal.ui.javaeditor.ClassFileDocumentProvider; import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider; import org.eclipse.jdt.internal.ui.preferences.MembersOrderPreferenceCache; import org.eclipse.jdt.internal.ui.viewsupport.ImageDescriptorRegistry; import org.eclipse.jdt.internal.ui.viewsupport.ProblemMarkerManager; /** * Represents the java plugin. It provides a series of convenience methods such as * access to the workbench, keeps track of elements shared by all editors and viewers * of the plugin such as document providers and find-replace-dialogs. */ public class JavaPlugin extends AbstractUIPlugin { // TODO: Evaluate if we should move these ID's to JavaUI /** * The id of the best match hover contributed for extension point * <code>javaEditorTextHovers</code>. * * @since 2.1 */ public static String ID_BESTMATCH_HOVER= "org.eclipse.jdt.ui.BestMatchHover"; //$NON-NLS-1$ /** * The id of the source code hover contributed for extension point * <code>javaEditorTextHovers</code>. * * @since 2.1 */ public static String ID_SOURCE_HOVER= "org.eclipse.jdt.ui.JavaSourceHover"; //$NON-NLS-1$ /** * The id of the javadoc hover contributed for extension point * <code>javaEditorTextHovers</code>. * * @since 2.1 */ public static String ID_JAVADOC_HOVER= "org.eclipse.jdt.ui.JavadocHover"; //$NON-NLS-1$ /** * The id of the problem hover contributed for extension point * <code>javaEditorTextHovers</code>. * * @since 2.1 */ public static String ID_PROBLEM_HOVER= "org.eclipse.jdt.ui.ProblemHover"; //$NON-NLS-1$ private static JavaPlugin fgJavaPlugin; private CompilationUnitDocumentProvider fCompilationUnitDocumentProvider; private ClassFileDocumentProvider fClassFileDocumentProvider; private JavaTextTools fJavaTextTools; private ProblemMarkerManager fProblemMarkerManager; private ImageDescriptorRegistry fImageDescriptorRegistry; private JavaElementAdapterFactory fJavaElementAdapterFactory; private MarkerAdapterFactory fMarkerAdapterFactory; private EditorInputAdapterFactory fEditorInputAdapterFactory; private ResourceAdapterFactory fResourceAdapterFactory; private MembersOrderPreferenceCache fMembersOrderPreferenceCache; public static JavaPlugin getDefault() { return fgJavaPlugin; } public static IWorkspace getWorkspace() { return ResourcesPlugin.getWorkspace(); } public static IWorkbenchPage getActivePage() { return getDefault().internalGetActivePage(); } public static IWorkbenchWindow getActiveWorkbenchWindow() { return getDefault().getWorkbench().getActiveWorkbenchWindow(); } public static Shell getActiveWorkbenchShell() { return getActiveWorkbenchWindow().getShell(); } /** * Returns an array of all editors that have an unsaved content. If the identical content is * presented in more than one editor, only one of those editor parts is part of the result. * * @return an array of all dirty editor parts. */ public static IEditorPart[] getDirtyEditors() { Set inputs= new HashSet(); List result= new ArrayList(0); IWorkbench workbench= getDefault().getWorkbench(); IWorkbenchWindow[] windows= workbench.getWorkbenchWindows(); for (int i= 0; i < windows.length; i++) { IWorkbenchPage[] pages= windows[i].getPages(); for (int x= 0; x < pages.length; x++) { IEditorPart[] editors= pages[x].getDirtyEditors(); for (int z= 0; z < editors.length; z++) { IEditorPart ep= editors[z]; IEditorInput input= ep.getEditorInput(); if (!inputs.contains(input)) { inputs.add(input); result.add(ep); } } } } return (IEditorPart[])result.toArray(new IEditorPart[result.size()]); } public static String getPluginId() { return getDefault().getDescriptor().getUniqueIdentifier(); } public static void log(IStatus status) { getDefault().getLog().log(status); } public static void logErrorMessage(String message) { log(new Status(IStatus.ERROR, getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, message, null)); } public static void logErrorStatus(String message, IStatus status) { if (status == null) { logErrorMessage(message); return; } MultiStatus multi= new MultiStatus(getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, message, null); multi.add(status); log(multi); } public static void log(Throwable e) { log(new Status(IStatus.ERROR, getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, JavaUIMessages.getString("JavaPlugin.internal_error"), e)); //$NON-NLS-1$ } public static boolean isDebug() { return getDefault().isDebugging(); } /* package */ static IPath getInstallLocation() { return new Path(getDefault().getDescriptor().getInstallURL().getFile()); } public static ImageDescriptorRegistry getImageDescriptorRegistry() { return getDefault().internalGetImageDescriptorRegistry(); } public JavaPlugin(IPluginDescriptor descriptor) { super(descriptor); fgJavaPlugin= this; } /* (non - Javadoc) * Method declared in Plugin */ public void startup() throws CoreException { super.startup(); registerAdapters(); } /* (non - Javadoc) * Method declared in AbstractUIPlugin */ protected ImageRegistry createImageRegistry() { return JavaPluginImages.getImageRegistry(); } /* (non - Javadoc) * Method declared in Plugin */ public void shutdown() throws CoreException { if (fImageDescriptorRegistry != null) fImageDescriptorRegistry.dispose(); unregisterAdapters(); super.shutdown(); if (fCompilationUnitDocumentProvider != null) { fCompilationUnitDocumentProvider.shutdown(); fCompilationUnitDocumentProvider= null; } if (fJavaTextTools != null) { fJavaTextTools.dispose(); fJavaTextTools= null; } JavaDocLocations.shutdownJavadocLocations(); } private IWorkbenchPage internalGetActivePage() { IWorkbenchWindow window= getWorkbench().getActiveWorkbenchWindow(); if (window == null) return null; return getWorkbench().getActiveWorkbenchWindow().getActivePage(); } public synchronized CompilationUnitDocumentProvider getCompilationUnitDocumentProvider() { if (fCompilationUnitDocumentProvider == null) fCompilationUnitDocumentProvider= new CompilationUnitDocumentProvider(); return fCompilationUnitDocumentProvider; } public synchronized ClassFileDocumentProvider getClassFileDocumentProvider() { if (fClassFileDocumentProvider == null) fClassFileDocumentProvider= new ClassFileDocumentProvider(); return fClassFileDocumentProvider; } public synchronized IWorkingCopyManager getWorkingCopyManager() { return getCompilationUnitDocumentProvider(); } public synchronized ProblemMarkerManager getProblemMarkerManager() { if (fProblemMarkerManager == null) fProblemMarkerManager= new ProblemMarkerManager(); return fProblemMarkerManager; } public synchronized JavaTextTools getJavaTextTools() { if (fJavaTextTools == null) fJavaTextTools= new JavaTextTools(getPreferenceStore()); return fJavaTextTools; } public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { if (fMembersOrderPreferenceCache == null) fMembersOrderPreferenceCache= new MembersOrderPreferenceCache(); return fMembersOrderPreferenceCache; } /** * Creates the Java plugin standard groups in a context menu. */ public static void createStandardGroups(IMenuManager menu) { if (!menu.isEmpty()) return; menu.add(new Separator(IContextMenuConstants.GROUP_NEW)); menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO)); menu.add(new Separator(IContextMenuConstants.GROUP_OPEN)); menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW)); menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE)); menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE)); menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH)); menu.add(new Separator(IContextMenuConstants.GROUP_BUILD)); menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS)); menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP)); menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES)); } /** * @see AbstractUIPlugin#initializeDefaultPreferences */ protected void initializeDefaultPreferences(IPreferenceStore store) { super.initializeDefaultPreferences(store); PreferenceConstants.initializeDefaultValues(store); } private synchronized ImageDescriptorRegistry internalGetImageDescriptorRegistry() { if (fImageDescriptorRegistry == null) fImageDescriptorRegistry= new ImageDescriptorRegistry(); return fImageDescriptorRegistry; } private void registerAdapters() { fJavaElementAdapterFactory= new JavaElementAdapterFactory(); fMarkerAdapterFactory= new MarkerAdapterFactory(); fEditorInputAdapterFactory= new EditorInputAdapterFactory(); fResourceAdapterFactory= new ResourceAdapterFactory(); IAdapterManager manager= Platform.getAdapterManager(); manager.registerAdapters(fJavaElementAdapterFactory, IJavaElement.class); manager.registerAdapters(fMarkerAdapterFactory, IMarker.class); manager.registerAdapters(fEditorInputAdapterFactory, IEditorInput.class); manager.registerAdapters(fResourceAdapterFactory, IResource.class); } private void unregisterAdapters() { IAdapterManager manager= Platform.getAdapterManager(); manager.unregisterAdapters(fJavaElementAdapterFactory); manager.unregisterAdapters(fMarkerAdapterFactory); manager.unregisterAdapters(fEditorInputAdapterFactory); manager.unregisterAdapters(fResourceAdapterFactory); } }
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionUtil.java
package org.eclipse.jdt.internal.ui.actions; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; /* * http://dev.eclipse.org/bugs/show_bug.cgi?id=19104 */ public class ActionUtil { public static boolean isProcessable(Shell shell, Object element) { if (!(element instanceof IJavaElement)) return true; if (checkJavaElement((IJavaElement)element)) return true; MessageDialog.openInformation(shell, ActionMessages.getString("ActionUtil.notOnBuildPath.title"), //$NON-NLS-1$ ActionMessages.getString("ActionUtil.notOnBuildPath.message")); //$NON-NLS-1$ return false; } private static boolean checkJavaElement(IJavaElement element) { //fix for bug http://dev.eclipse.org/bugs/show_bug.cgi?id=20051 if (element.getElementType() == IJavaElement.JAVA_PROJECT) return true; IJavaProject project= element.getJavaProject(); try { if (!project.isOnClasspath(element)) return false; IProject resourceProject= project.getProject(); if (resourceProject == null) return false; IProjectNature nature= resourceProject.getNature(JavaCore.NATURE_ID); // We have a Java project if (nature != null) return true; } catch (CoreException e) { } return false; } }
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/ExtractMethodAction.java
/******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.ui.actions; import org.eclipse.jface.text.IRewriteTarget; import org.eclipse.jface.text.ITextSelection; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.corext.refactoring.base.Refactoring; import org.eclipse.jdt.internal.corext.refactoring.code.ExtractMethodRefactoring; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.actions.SelectionConverter; import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor; import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; import org.eclipse.jdt.internal.ui.refactoring.RefactoringMessages; import org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard; import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter; import org.eclipse.jdt.internal.ui.refactoring.code.ExtractMethodWizard; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; /** * Extracts the code selected inside a compilation unit editor into a new method. * Necessary arguments, exceptions and returns values are computed and an * appropriate method signature is generated. * * <p> * This class may be instantiated; it is not intended to be subclassed. * </p> * * @since 2.0 */ public class ExtractMethodAction extends SelectionDispatchAction { private CompilationUnitEditor fEditor; private String fDialogMessageTitle; /** * Note: This constructor is for internal use only. Clients should not call this constructor. */ public ExtractMethodAction(CompilationUnitEditor editor) { super(editor.getEditorSite()); setText(RefactoringMessages.getString("ExtractMethodAction.label"));//$NON-NLS-1$ fEditor= editor; fDialogMessageTitle= RefactoringMessages.getString("ExtractMethodAction.dialog.title");//$NON-NLS-1$ setEnabled(SelectionConverter.getInputAsCompilationUnit(fEditor) != null); WorkbenchHelp.setHelp(this, IJavaHelpContextIds.EXTRACT_METHOD_ACTION); } /* (non-Javadoc) * Method declared on SelectionDispatchAction */ protected void run(ITextSelection selection) { IRewriteTarget target= null; try{ target= (IRewriteTarget)fEditor.getAdapter(IRewriteTarget.class); if (target != null) target.beginCompoundChange(); Refactoring refactoring= createRefactoring(SelectionConverter.getInputAsCompilationUnit(fEditor), selection); new RefactoringStarter().activate(refactoring, createWizard(refactoring), getShell(), fDialogMessageTitle, false); } catch (JavaModelException e){ ExceptionHandler.handle(e, fDialogMessageTitle, RefactoringMessages.getString("NewTextRefactoringAction.exception")); //$NON-NLS-1$ } finally { if (target != null) target.endCompoundChange(); } } /* (non-Javadoc) * Method declared on SelectionDispatchAction */ protected void selectionChanged(ITextSelection selection) { setEnabled(checkEnabled(selection)); } private Refactoring createRefactoring(ICompilationUnit cunit, ITextSelection selection) throws JavaModelException { return new ExtractMethodRefactoring( cunit, selection.getOffset(), selection.getLength(), JavaPreferencesSettings.getCodeGenerationSettings()); } private RefactoringWizard createWizard(Refactoring refactoring) { return new ExtractMethodWizard((ExtractMethodRefactoring)refactoring); } private boolean checkEnabled(ITextSelection selection) { if (selection.getLength() == 0) return false; return fEditor != null && SelectionConverter.getInputAsCompilationUnit(fEditor) != null; } }
28,244
Bug 28244 Edit->Undo / Refactor->Undo don't play well together
reproducible in I20021210 with the following steps and code: - select "b + c" - extract local - edit->undo - refactor->undo public class Test { public Test() { int a= 1; int b= 2; int c= 3; int d= a + b + c; } }
resolved fixed
de1133c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T13:01:51Z
2002-12-13T09:00:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/SurroundWithTryCatchAction.java
/******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v0.5 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.ui.actions; import java.lang.reflect.InvocationTargetException; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.text.IRewriteTarget; import org.eclipse.jface.text.ITextSelection; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.ISourceRange; import org.eclipse.jdt.internal.corext.refactoring.base.ChangeContext; import org.eclipse.jdt.internal.corext.refactoring.base.JavaSourceContext; import org.eclipse.jdt.internal.corext.refactoring.base.RefactoringStatus; import org.eclipse.jdt.internal.corext.refactoring.base.RefactoringStatusEntry; import org.eclipse.jdt.internal.corext.refactoring.surround.ISurroundWithTryCatchQuery; import org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefactoring; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.actions.SelectionConverter; import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor; import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; import org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation; import org.eclipse.jdt.internal.ui.refactoring.RefactoringMessages; import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringErrorDialogUtil; import org.eclipse.jdt.internal.ui.refactoring.changes.AbortChangeExceptionHandler; import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext; import org.eclipse.jdt.internal.ui.util.ElementValidator; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; /** * Action to surround a set of statements with a try/catch block. * * <p> * This class may be instantiated; it is not intended to be subclassed. * </p> * * @since 2.0 */ public class SurroundWithTryCatchAction extends SelectionDispatchAction { private CompilationUnitEditor fEditor; private static class Query implements ISurroundWithTryCatchQuery { private Shell fParent; public Query(Shell shell) { fParent= shell; } public boolean catchRuntimeException() { MessageDialog dialog = new MessageDialog( fParent, getDialogTitle(), null, // accept the default window icon RefactoringMessages.getString("SurroundWithTryCatchAction.no_exceptions"), //$NON-NLS-1$ MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 1); return dialog.open() == 0; // yes selected } } /** * Note: This constructor is for internal use only. Clients should not call this constructor. */ public SurroundWithTryCatchAction(CompilationUnitEditor editor) { super(editor.getEditorSite()); setText(RefactoringMessages.getString("SurroundWithTryCatchAction.label")); //$NON-NLS-1$); fEditor= editor; setEnabled(checkEditor()); WorkbenchHelp.setHelp(this, IJavaHelpContextIds.SURROUND_WITH_TRY_CATCH_ACTION); } protected void run(ITextSelection selection) { ICompilationUnit cu= getCompilationUnit(); if (cu == null || !ElementValidator.checkValidateEdit(cu, getShell(), getDialogTitle())) return; SurroundWithTryCatchRefactoring refactoring= new SurroundWithTryCatchRefactoring(getCompilationUnit(), selection, JavaPreferencesSettings.getCodeGenerationSettings(), new Query(getShell())); IRewriteTarget target= null; try { target= (IRewriteTarget)fEditor.getAdapter(IRewriteTarget.class); if (target != null) target.beginCompoundChange(); RefactoringStatus status= refactoring.checkActivation(new NullProgressMonitor()); if (status.hasFatalError()) { RefactoringErrorDialogUtil.open(getDialogTitle(), status); RefactoringStatusEntry entry= status.getFirstEntry(RefactoringStatus.FATAL); if (entry.getContext() instanceof JavaSourceContext && fEditor != null) { JavaSourceContext context= (JavaSourceContext)entry.getContext(); ISourceRange range= context.getSourceRange(); fEditor.setHighlightRange(range.getOffset(), range.getLength(), true); } return; } if (refactoring.stopExecution()) return; PerformChangeOperation op= new PerformChangeOperation(refactoring.createChange(new NullProgressMonitor())); op.setChangeContext(new ChangeContext(new AbortChangeExceptionHandler())); new BusyIndicatorRunnableContext().run(false, false, op); } catch (CoreException e) { ExceptionHandler.handle(e, getDialogTitle(), RefactoringMessages.getString("SurroundWithTryCatchAction.exception")); //$NON-NLS-1$ } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getDialogTitle(), RefactoringMessages.getString("SurroundWithTryCatchAction.exception")); //$NON-NLS-1$ } catch (InterruptedException e) { // not cancelable } finally { if (target != null) target.endCompoundChange(); } } protected void selectionChanged(ITextSelection selection) { setEnabled(selection.getLength() > 0 && checkEditor()); } private final ICompilationUnit getCompilationUnit() { return SelectionConverter.getInputAsCompilationUnit(fEditor); } private boolean checkEditor() { return fEditor != null && getCompilationUnit() != null; } private static String getDialogTitle() { return RefactoringMessages.getString("SurroundWithTryCatchAction.dialog.title"); //$NON-NLS-1$ } }
26,288
Bug 26288 use supertype - doesn't get all possible cases [refactoring]
I-20021113 w2k: Use supertype A instead of B: The first example doesn't touch the unnecessary cast to B, while the second example works as expected. class Test1 { class A {} class B extends A {} void foo() { B b= null; A a= (B) b; String s= a.toString(); } } class Test2 { class A {} class B extends A {} void foo() { B b= null; String s= ((B) b).toString(); } }
resolved fixed
8d8700a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T14:56:01Z
2002-11-14T13:20:00Z
org.eclipse.jdt.ui/core
26,288
Bug 26288 use supertype - doesn't get all possible cases [refactoring]
I-20021113 w2k: Use supertype A instead of B: The first example doesn't touch the unnecessary cast to B, while the second example works as expected. class Test1 { class A {} class B extends A {} void foo() { B b= null; A a= (B) b; String s= a.toString(); } } class Test2 { class A {} class B extends A {} void foo() { B b= null; String s= ((B) b).toString(); } }
resolved fixed
8d8700a
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T14:56:01Z
2002-11-14T13:20:00Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/UseSupertypeWherePossibleUtil.java
28,369
Bug 28369 [search] Java search results shown with squashed icons
The stop/halt icon (used for unknown images) doesn't have the correct size and a search result including such an icon shows up incorrectly. The icon should have the same width as the Java Element Labels with adornments. We should also use a different icon (question mark, or just a grey sphere) in this case. The halt icon is too invasive.
resolved fixed
17c077c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T15:49:56Z
2002-12-16T14:46:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPluginImages.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.ui; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.Iterator; import org.eclipse.swt.graphics.Image; import org.eclipse.jface.action.IAction; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageRegistry; /** * Bundle of most images used by the Java plugin. */ public class JavaPluginImages { private static final String NAME_PREFIX= "org.eclipse.jdt.ui."; //$NON-NLS-1$ private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length(); private static URL fgIconBaseURL= null; // Determine display depth. If depth > 4 then we use high color images. Otherwise low color // images are used static { String pathSuffix= "icons/full/"; //$NON-NLS-1$ try { fgIconBaseURL= new URL(JavaPlugin.getDefault().getDescriptor().getInstallURL(), pathSuffix); } catch (MalformedURLException e) { // do nothing } } // The plugin registry private static ImageRegistry fgImageRegistry= null; private static HashMap fgAvoidSWTErrorMap= null; /* * Available cached Images in the Java plugin image registry. */ public static final String IMG_MISC_PUBLIC= NAME_PREFIX + "methpub_obj.gif"; //$NON-NLS-1$ public static final String IMG_MISC_PROTECTED= NAME_PREFIX + "methpro_obj.gif"; //$NON-NLS-1$ public static final String IMG_MISC_PRIVATE= NAME_PREFIX + "methpri_obj.gif"; //$NON-NLS-1$ public static final String IMG_MISC_DEFAULT= NAME_PREFIX + "methdef_obj.gif"; //$NON-NLS-1$ public static final String IMG_FIELD_PUBLIC= NAME_PREFIX + "field_public_obj.gif"; //$NON-NLS-1$ public static final String IMG_FIELD_PROTECTED= NAME_PREFIX + "field_protected_obj.gif"; //$NON-NLS-1$ public static final String IMG_FIELD_PRIVATE= NAME_PREFIX + "field_private_obj.gif"; //$NON-NLS-1$ public static final String IMG_FIELD_DEFAULT= NAME_PREFIX + "field_default_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_GHOST= NAME_PREFIX + "ghost.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_SEARCH_TSK= NAME_PREFIX + "search_tsk.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_PACKDECL= NAME_PREFIX + "packd_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_IMPDECL= NAME_PREFIX + "imp_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_IMPCONT= NAME_PREFIX + "impc_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_JSEARCH= NAME_PREFIX + "jsearch_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_SEARCH_DECL= NAME_PREFIX + "search_decl_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_SEARCH_REF= NAME_PREFIX + "search_ref_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_CLASS= NAME_PREFIX + "class_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_CLASSALT= NAME_PREFIX + "classfo_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_CLASS_DEFAULT= NAME_PREFIX + "class_default_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_INTERFACE= NAME_PREFIX + "int_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_INTERFACEALT= NAME_PREFIX + "intf_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_INTERFACE_DEFAULT= NAME_PREFIX + "int_default_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_CUNIT= NAME_PREFIX + "jcu_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_CUNIT_RESOURCE= NAME_PREFIX + "jcu_resource_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_CFILE= NAME_PREFIX + "classf_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_CFILECLASS= NAME_PREFIX + "class_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_CFILEINT= NAME_PREFIX + "int_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_LOGICAL_PACKAGE= NAME_PREFIX + "logical_package_obj.gif";//$NON-NLS-1$ public static final String IMG_OJS_EMPTY_LOGICAL_PACKAGE= NAME_PREFIX + "empty_logical_package_obj.gif";//$NON-NLS-1$ public static final String IMG_OBJS_PACKAGE= NAME_PREFIX + "package_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_EMPTY_PACK_RESOURCE= NAME_PREFIX + "empty_pack_fldr_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_EMPTY_PACKAGE= NAME_PREFIX + "empty_pack_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_PACKFRAG_ROOT= NAME_PREFIX + "packagefolder_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_MISSING_PACKFRAG_ROOT= NAME_PREFIX + "packagefolder_nonexist_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_MISSING_JAR= NAME_PREFIX + "jar_nonexist_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_JAR= NAME_PREFIX + "jar_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_EXTJAR= NAME_PREFIX + "jar_l_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_JAR_WSRC= NAME_PREFIX + "jar_src_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_EXTJAR_WSRC= NAME_PREFIX + "jar_lsrc_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_ENV_VAR= NAME_PREFIX + "envvar_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_MISSING_ENV_VAR= NAME_PREFIX + "envvar_nonexist_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_JAVA_MODEL= NAME_PREFIX + "java_model_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_LIBRARY= NAME_PREFIX + "library_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_JAVADOCTAG= NAME_PREFIX + "jdoc_tag_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_HTMLTAG= NAME_PREFIX + "html_tag_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_TEMPLATE= NAME_PREFIX + "template_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_EXCEPTION= NAME_PREFIX + "jexception_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_ERROR= NAME_PREFIX + "jrtexception_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_BREAKPOINT_INSTALLED= NAME_PREFIX + "brkpi_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_FIXABLE_PROBLEM= NAME_PREFIX + "quickfix_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_SNIPPET_EVALUATING= NAME_PREFIX + "jsbook_run_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_REFACTORING_FATAL= NAME_PREFIX + "fatalerror_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_REFACTORING_ERROR= NAME_PREFIX + "error_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_REFACTORING_WARNING= NAME_PREFIX + "warning_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_REFACTORING_INFO= NAME_PREFIX + "info_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_NLS_TRANSLATE= NAME_PREFIX + "translate.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_NLS_NEVER_TRANSLATE= NAME_PREFIX + "never_translate.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_NLS_SKIP= NAME_PREFIX + "skip.gif"; //$NON-NLS-1$ /* * Set of predefined Image Descriptors. */ private static final String T_OBJ= "obj16"; //$NON-NLS-1$ private static final String T_OVR= "ovr16"; //$NON-NLS-1$ private static final String T_WIZBAN= "wizban"; //$NON-NLS-1$ private static final String T_CLCL= "clcl16"; //$NON-NLS-1$ private static final String T_DLCL= "dlcl16"; //$NON-NLS-1$ private static final String T_CTOOL= "ctool16"; //$NON-NLS-1$ private static final String T_CVIEW= "cview16"; //$NON-NLS-1$ public static final ImageDescriptor DESC_VIEW_ERRORWARNING_TAB= create(T_CVIEW, "errorwarning_tab.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_VIEW_CLASSFILEGENERATION_TAB= create(T_CVIEW, "classfilegeneration_tab.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_VIEW_JDKCOMPLIANCE_TAB= create(T_CVIEW, "jdkcompliance_tab.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_CLCL_CODE_ASSIST= create(T_CLCL, "metharg_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_DLCL_CODE_ASSIST= create(T_DLCL, "metharg_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_MISC_PUBLIC= createManaged(T_OBJ, IMG_MISC_PUBLIC); public static final ImageDescriptor DESC_MISC_PROTECTED= createManaged(T_OBJ, IMG_MISC_PROTECTED); public static final ImageDescriptor DESC_MISC_PRIVATE= createManaged(T_OBJ, IMG_MISC_PRIVATE); public static final ImageDescriptor DESC_MISC_DEFAULT= createManaged(T_OBJ, IMG_MISC_DEFAULT); public static final ImageDescriptor DESC_FIELD_PUBLIC= createManaged(T_OBJ, IMG_FIELD_PUBLIC); //$NON-NLS-1$ public static final ImageDescriptor DESC_FIELD_PROTECTED= createManaged(T_OBJ, IMG_FIELD_PROTECTED); //$NON-NLS-1$ public static final ImageDescriptor DESC_FIELD_PRIVATE= createManaged(T_OBJ, IMG_FIELD_PRIVATE); //$NON-NLS-1$ public static final ImageDescriptor DESC_FIELD_DEFAULT= createManaged(T_OBJ, IMG_FIELD_DEFAULT); //$NON-NLS-1$ public static final ImageDescriptor DESC_MENU_SHIFT_RIGHT= create(T_CTOOL, "shift_r_edit.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_MENU_SHIFT_LEFT= create(T_CTOOL, "shift_l_edit.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_GHOST= createManaged(T_OBJ, IMG_OBJS_GHOST); public static final ImageDescriptor DESC_OBJS_PACKDECL= createManaged(T_OBJ, IMG_OBJS_PACKDECL); public static final ImageDescriptor DESC_OBJS_IMPDECL= createManaged(T_OBJ, IMG_OBJS_IMPDECL); public static final ImageDescriptor DESC_OBJS_IMPCONT= createManaged(T_OBJ, IMG_OBJS_IMPCONT); public static final ImageDescriptor DESC_OBJS_JSEARCH= createManaged(T_OBJ, IMG_OBJS_JSEARCH); public static final ImageDescriptor DESC_OBJS_SEARCH_DECL= createManaged(T_OBJ, IMG_OBJS_SEARCH_DECL); public static final ImageDescriptor DESC_OBJS_SEARCH_REF= createManaged(T_OBJ, IMG_OBJS_SEARCH_REF); public static final ImageDescriptor DESC_OBJS_CUNIT= createManaged(T_OBJ, IMG_OBJS_CUNIT); public static final ImageDescriptor DESC_OBJS_CUNIT_RESOURCE= createManaged(T_OBJ, IMG_OBJS_CUNIT_RESOURCE); public static final ImageDescriptor DESC_OBJS_CFILE= createManaged(T_OBJ, IMG_OBJS_CFILE); public static final ImageDescriptor DESC_OBJS_CFILECLASS= createManaged(T_OBJ, IMG_OBJS_CFILECLASS); public static final ImageDescriptor DESC_OBJS_CFILEINT= createManaged(T_OBJ, IMG_OBJS_CFILEINT); public static final ImageDescriptor DESC_OBJS_PACKAGE= createManaged(T_OBJ, IMG_OBJS_PACKAGE); public static final ImageDescriptor DESC_OBJS_EMPTY_LOGICAL_PACKAGE= createManaged(T_OBJ, IMG_OJS_EMPTY_LOGICAL_PACKAGE); public static final ImageDescriptor DESC_OBJS_LOGICAL_PACKAGE= createManaged(T_OBJ, IMG_OBJS_LOGICAL_PACKAGE); public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE_RESOURCES= createManaged(T_OBJ, IMG_OBJS_EMPTY_PACK_RESOURCE); public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE= createManaged(T_OBJ, IMG_OBJS_EMPTY_PACKAGE); public static final ImageDescriptor DESC_OBJS_PACKFRAG_ROOT= createManaged(T_OBJ, IMG_OBJS_PACKFRAG_ROOT); public static final ImageDescriptor DESC_OBJS_MISSING_PACKFRAG_ROOT= createManaged(T_OBJ, IMG_OBJS_MISSING_PACKFRAG_ROOT); public static final ImageDescriptor DESC_OBJS_JAVA_MODEL= createManaged(T_OBJ, IMG_OBJS_JAVA_MODEL); public static final ImageDescriptor DESC_OBJS_CLASS= createManaged(T_OBJ, IMG_OBJS_CLASS); public static final ImageDescriptor DESC_OBJS_CLASS_DEFAULT= createManaged(T_OBJ, IMG_OBJS_CLASS_DEFAULT); public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PUBLIC= create(T_OBJ, "innerclass_public_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_INNER_CLASS_DEFAULT= create(T_OBJ, "innerclass_default_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PROTECTED= create(T_OBJ, "innerclass_protected_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PRIVATE= create(T_OBJ, "innerclass_private_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_CLASSALT= createManaged(T_OBJ, IMG_OBJS_CLASSALT); public static final ImageDescriptor DESC_OBJS_INTERFACE= createManaged(T_OBJ, IMG_OBJS_INTERFACE); public static final ImageDescriptor DESC_OBJS_INTERFACE_DEFAULT= createManaged(T_OBJ, IMG_OBJS_INTERFACE_DEFAULT); public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PUBLIC= create(T_OBJ, "innerinterface_public_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_DEFAULT= create(T_OBJ, "innerinterface_default_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PROTECTED= create(T_OBJ, "innerinterface_protected_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PRIVATE= create(T_OBJ, "innerinterface_private_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_INTERFACEALT= createManaged(T_OBJ, IMG_OBJS_INTERFACEALT); public static final ImageDescriptor DESC_OBJS_JAR= createManaged(T_OBJ, IMG_OBJS_JAR); public static final ImageDescriptor DESC_OBJS_MISSING_JAR= createManaged(T_OBJ, IMG_OBJS_MISSING_JAR); public static final ImageDescriptor DESC_OBJS_EXTJAR= createManaged(T_OBJ, IMG_OBJS_EXTJAR); public static final ImageDescriptor DESC_OBJS_JAR_WSRC= createManaged(T_OBJ, IMG_OBJS_JAR_WSRC); public static final ImageDescriptor DESC_OBJS_EXTJAR_WSRC= createManaged(T_OBJ, IMG_OBJS_EXTJAR_WSRC); public static final ImageDescriptor DESC_OBJS_ENV_VAR= createManaged(T_OBJ, IMG_OBJS_ENV_VAR); public static final ImageDescriptor DESC_OBJS_MISSING_ENV_VAR= createManaged(T_OBJ, IMG_OBJS_MISSING_ENV_VAR); public static final ImageDescriptor DESC_OBJS_LIBRARY= createManaged(T_OBJ, IMG_OBJS_LIBRARY); public static final ImageDescriptor DESC_OBJS_JAVADOCTAG= createManaged(T_OBJ, IMG_OBJS_JAVADOCTAG); public static final ImageDescriptor DESC_OBJS_HTMLTAG= createManaged(T_OBJ, IMG_OBJS_HTMLTAG); public static final ImageDescriptor DESC_OBJS_TEMPLATE= createManaged(T_OBJ, IMG_OBJS_TEMPLATE); public static final ImageDescriptor DESC_OBJS_EXCEPTION= createManaged(T_OBJ, IMG_OBJS_EXCEPTION); public static final ImageDescriptor DESC_OBJS_BREAKPOINT_INSTALLED= createManaged(T_OBJ, IMG_OBJS_BREAKPOINT_INSTALLED); public static final ImageDescriptor DESC_OBJS_ERROR= createManaged(T_OBJ, IMG_OBJS_ERROR); public static final ImageDescriptor DESC_OBJS_FIXABLE_PROBLEM= createManaged(T_OBJ, IMG_OBJS_FIXABLE_PROBLEM); public static final ImageDescriptor DESC_OBJS_SNIPPET_EVALUATING= createManaged(T_OBJ, IMG_OBJS_SNIPPET_EVALUATING); public static final ImageDescriptor DESC_OBJS_DEFAULT_CHANGE= create(T_OBJ, "change.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_COMPOSITE_CHANGE= create(T_OBJ, "composite_change.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_CU_CHANGE= create(T_OBJ, "cu_change.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_FILE_CHANGE= create(T_OBJ, "file_change.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_TEXT_EDIT= create(T_OBJ, "text_edit.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB= create(T_OBJ, "exclusion_filter_attrib.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_OUTPUT_FOLDER_ATTRIB= create(T_OBJ, "output_folder_attrib.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OBJS_REFACTORING_FATAL= createManaged(T_OBJ, IMG_OBJS_REFACTORING_FATAL); public static final ImageDescriptor DESC_OBJS_REFACTORING_ERROR= createManaged(T_OBJ, IMG_OBJS_REFACTORING_ERROR); public static final ImageDescriptor DESC_OBJS_REFACTORING_WARNING= createManaged(T_OBJ, IMG_OBJS_REFACTORING_WARNING); public static final ImageDescriptor DESC_OBJS_REFACTORING_INFO= createManaged(T_OBJ, IMG_OBJS_REFACTORING_INFO); public static final ImageDescriptor DESC_OBJS_NLS_TRANSLATE= createManaged(T_OBJ, IMG_OBJS_NLS_TRANSLATE); public static final ImageDescriptor DESC_OBJS_NLS_NEVER_TRANSLATE= createManaged(T_OBJ, IMG_OBJS_NLS_NEVER_TRANSLATE); public static final ImageDescriptor DESC_OBJS_NLS_SKIP= createManaged(T_OBJ, IMG_OBJS_NLS_SKIP); public static final ImageDescriptor DESC_OBJS_LOCAL_VARIABLE= create(T_OBJ, "localvariable_obj.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_STATIC= create(T_OVR, "static_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_FINAL= create(T_OVR, "final_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_ABSTRACT= create(T_OVR, "abstract_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_SYNCH= create(T_OVR, "synch_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_RUN= create(T_OVR, "run_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_WARNING= create(T_OVR, "warning_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_ERROR= create(T_OVR, "error_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_OVERRIDES= create(T_OVR, "over_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_IMPLEMENTS= create(T_OVR, "implm_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_CONSTRUCTOR= create(T_OVR, "constr_ovr.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_FOCUS= create(T_OVR, "focus_ovr.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_NEWCLASS= create(T_WIZBAN, "newclass_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_NEWFIELD= create(T_WIZBAN, "newfield_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_NEWINT= create(T_WIZBAN, "newint_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_NEWJPRJ= create(T_WIZBAN, "newjprj_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_NEWSRCFOLDR= create(T_WIZBAN, "newsrcfldr_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_NEWMETH= create(T_WIZBAN, "newmeth_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_NEWPACK= create(T_WIZBAN, "newpack_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_NEWSCRAPPAGE= create(T_WIZBAN, "newsbook_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_JAVA_LAUNCH= create(T_WIZBAN, "java_app_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_JAVA_ATTACH= create(T_WIZBAN, "java_attach_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_REFACTOR= create(T_WIZBAN, "refactor_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIELD= create(T_WIZBAN, "fieldrefact_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_METHOD= create(T_WIZBAN, "methrefact_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_TYPE= create(T_WIZBAN, "typerefact_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PACKAGE= create(T_WIZBAN, "packrefact_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CODE= create(T_WIZBAN, "coderefact_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CU= create(T_WIZBAN, "compunitrefact_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PULL_UP= create(T_WIZBAN, "pullup_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_JAR_PACKAGER= create(T_WIZBAN, "jar_pack_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_JAVA_WORKINGSET= create(T_WIZBAN, "java_workingset_wiz.gif");//$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_EXPORT_JAVADOC= create(T_WIZBAN, "export_javadoc_wiz.gif");//$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_EXTERNALIZE_STRINGS= create(T_WIZBAN, "extstr_wiz.gif");//$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_DISPLAYSNIPPET= create(T_CTOOL, "disp_sbook.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_RUNSNIPPET= create(T_CTOOL, "run_sbook.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_INSPSNIPPET= create(T_CTOOL, "insp_sbook.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_PACKSNIPPET= create(T_CTOOL, "pack_sbook.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_TERMSNIPPET= create(T_CTOOL, "term_sbook.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_SHOW_EMPTY_PKG= create(T_CTOOL, "show_empty_pkg.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_SHOW_SEGMENTS= create(T_CTOOL, "segment_edit.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_GOTO_NEXT_ERROR= create(T_CTOOL, "next_error_nav.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_GOTO_PREV_ERROR= create(T_CTOOL, "prev_error_nav.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_OPENTYPE= create(T_CTOOL, "opentype.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_NEWPROJECT= create(T_CTOOL, "newjprj_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_NEWPACKAGE= create(T_CTOOL, "newpack_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_NEWCLASS= create(T_CTOOL, "newclass_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_NEWINTERFACE= create(T_CTOOL, "newint_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_NEWSNIPPET= create(T_CTOOL, "newsbook_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_NEWPACKROOT= create(T_CTOOL, "newpackfolder_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOL_CLASSPATH_ORDER= create(T_OBJ, "cp_order_obj.gif"); //$NON-NLS-1$ // Keys for correction proposal. We have to put the image into the registry since "code assist" doesn't // have a life cycle. So no change to dispose icons. public static final String IMG_CORRECTION_CHANGE= NAME_PREFIX + "correction_change.gif"; //$NON-NLS-1$ public static final String IMG_CORRECTION_MOVE= NAME_PREFIX + "correction_move.gif"; //$NON-NLS-1$ public static final String IMG_CORRECTION_RENAME= NAME_PREFIX + "correction_rename.gif"; //$NON-NLS-1$ public static final String IMG_CORRECTION_DELETE_IMPORT= NAME_PREFIX + "correction_delete_import.gif"; //$NON-NLS-1$ public static final String IMG_CORRECTION_LOCAL= NAME_PREFIX + "localvariable_obj.gif"; //$NON-NLS-1$ static { createManaged(T_OBJ, IMG_CORRECTION_CHANGE); createManaged(T_OBJ, IMG_CORRECTION_MOVE); createManaged(T_OBJ, IMG_CORRECTION_RENAME); createManaged(T_OBJ, IMG_CORRECTION_DELETE_IMPORT); createManaged(T_OBJ, IMG_CORRECTION_LOCAL); } /** * Returns the image managed under the given key in this registry. * * @param key the image's key * @return the image managed under the given key */ public static Image get(String key) { return getImageRegistry().get(key); } /** * Sets the three image descriptors for enabled, disabled, and hovered to an action. The actions * are retrieved from the *tool16 folders. */ public static void setToolImageDescriptors(IAction action, String iconName) { setImageDescriptors(action, "tool16", iconName); //$NON-NLS-1$ } /** * Sets the three image descriptors for enabled, disabled, and hovered to an action. The actions * are retrieved from the *lcl16 folders. */ public static void setLocalImageDescriptors(IAction action, String iconName) { setImageDescriptors(action, "lcl16", iconName); //$NON-NLS-1$ } /* * Helper method to access the image registry from the JavaPlugin class. */ /* package */ static ImageRegistry getImageRegistry() { if (fgImageRegistry == null) { fgImageRegistry= new ImageRegistry(); for (Iterator iter= fgAvoidSWTErrorMap.keySet().iterator(); iter.hasNext();) { String key= (String) iter.next(); fgImageRegistry.put(key, (ImageDescriptor) fgAvoidSWTErrorMap.get(key)); } fgAvoidSWTErrorMap= null; } return fgImageRegistry; } //---- Helper methods to access icons on the file system -------------------------------------- private static void setImageDescriptors(IAction action, String type, String relPath) { try { ImageDescriptor id= ImageDescriptor.createFromURL(makeIconFileURL("d" + type, relPath)); //$NON-NLS-1$ if (id != null) action.setDisabledImageDescriptor(id); } catch (MalformedURLException e) { } try { ImageDescriptor id= ImageDescriptor.createFromURL(makeIconFileURL("c" + type, relPath)); //$NON-NLS-1$ if (id != null) action.setHoverImageDescriptor(id); } catch (MalformedURLException e) { } action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$ } private static ImageDescriptor createManaged(String prefix, String name) { try { ImageDescriptor result= ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH))); if (fgAvoidSWTErrorMap == null) { fgAvoidSWTErrorMap= new HashMap(); } fgAvoidSWTErrorMap.put(name, result); if (fgImageRegistry != null) { JavaPlugin.logErrorMessage("Image registry already defined"); //$NON-NLS-1$ } return result; } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } } private static ImageDescriptor create(String prefix, String name) { try { return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); } catch (MalformedURLException e) { return ImageDescriptor.getMissingImageDescriptor(); } } private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException { if (fgIconBaseURL == null) throw new MalformedURLException(); StringBuffer buffer= new StringBuffer(prefix); buffer.append('/'); buffer.append(name); return new URL(fgIconBaseURL, buffer.toString()); } }
28,369
Bug 28369 [search] Java search results shown with squashed icons
The stop/halt icon (used for unknown images) doesn't have the correct size and a search result including such an icon shows up incorrectly. The icon should have the same width as the Java Element Labels with adornments. We should also use a different icon (question mark, or just a grey sphere) in this case. The halt icon is too invasive.
resolved fixed
17c077c
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T15:49:56Z
2002-12-16T14:46:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchResultLabelProvider.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.ui.search; import org.eclipse.core.resources.IMarker; import org.eclipse.swt.graphics.Image; import org.eclipse.jface.viewers.ILabelDecorator; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.ui.PlatformUI; import org.eclipse.search.ui.ISearchResultViewEntry; import org.eclipse.search.ui.SearchUI; import org.eclipse.jdt.core.IImportDeclaration; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.ui.OverrideIndicatorLabelDecorator; import org.eclipse.jdt.ui.ProblemsLabelDecorator; import org.eclipse.jdt.internal.ui.viewsupport.AppearanceAwareLabelProvider; import org.eclipse.jdt.internal.ui.viewsupport.JavaElementLabels; import org.eclipse.jdt.internal.ui.JavaPluginImages; public class JavaSearchResultLabelProvider extends LabelProvider { public static final int SHOW_ELEMENT_CONTAINER= 1; // default public static final int SHOW_CONTAINER_ELEMENT= 2; public static final int SHOW_PATH= 3; public static final String POTENTIAL_MATCH= SearchMessages.getString("JavaSearchResultLabelProvider.potentialMatch"); //$NON-NLS-1$ private AppearanceAwareLabelProvider fLabelProvider; private ILabelDecorator fDecorator; // Cache private IMarker fLastMarker; private IJavaElement fLastJavaElement; public JavaSearchResultLabelProvider() { fDecorator= PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(); fLabelProvider= new AppearanceAwareLabelProvider( AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | JavaElementLabels.P_COMPRESSED, AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS); fLabelProvider.addLabelDecorator(new ProblemsLabelDecorator(null)); fLabelProvider.addLabelDecorator(new OverrideIndicatorLabelDecorator(null)); } public String getText(Object o) { fLastMarker= null; IJavaElement javaElement= getJavaElement(o); // sets fLastMarker as side effect boolean isPotentialMatch= fLastMarker != null && fLastMarker.getAttribute(SearchUI.POTENTIAL_MATCH, false); if (javaElement == null) { if (fLastMarker != null) { if (isPotentialMatch) return super.getText(fLastMarker.getResource()) + POTENTIAL_MATCH; else return super.getText(fLastMarker.getResource()); } else return ""; //$NON-NLS-1$ } if (javaElement instanceof IImportDeclaration) javaElement= ((IImportDeclaration)javaElement).getParent().getParent(); String text= ""; //$NON-NLS-1$ if (isPotentialMatch) text= fLabelProvider.getText(javaElement) + POTENTIAL_MATCH; else text= fLabelProvider.getText(javaElement); if (fDecorator != null) { String decoratedText= fDecorator.decorateText(text, javaElement); if (decoratedText != null) return decoratedText; } return text; } public Image getImage(Object o) { IJavaElement javaElement= getJavaElement(o); if (javaElement == null || !javaElement.exists()) return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_REFACTORING_FATAL); Image image= fLabelProvider.getImage(javaElement); if (fDecorator != null) { Image decoratedImage= fDecorator.decorateImage(image, javaElement); if (decoratedImage != null) return decoratedImage; } return image; } public void setOrder(int orderFlag) { int flags= AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | JavaElementLabels.P_COMPRESSED; if (orderFlag == SHOW_ELEMENT_CONTAINER) flags |= JavaElementLabels.F_POST_QUALIFIED | JavaElementLabels.M_POST_QUALIFIED | JavaElementLabels.I_POST_QUALIFIED | JavaElementLabels.M_PARAMETER_TYPES | JavaElementLabels.T_POST_QUALIFIED | JavaElementLabels.D_POST_QUALIFIED | JavaElementLabels.CF_POST_QUALIFIED | JavaElementLabels.CU_POST_QUALIFIED; else if (orderFlag == SHOW_CONTAINER_ELEMENT) flags |= JavaElementLabels.F_FULLY_QUALIFIED | JavaElementLabels.M_FULLY_QUALIFIED | JavaElementLabels.I_FULLY_QUALIFIED | JavaElementLabels.M_PARAMETER_TYPES | JavaElementLabels.T_FULLY_QUALIFIED | JavaElementLabels.D_QUALIFIED | JavaElementLabels.CF_QUALIFIED | JavaElementLabels.CU_QUALIFIED; else if (orderFlag == SHOW_PATH) { flags |= JavaElementLabels.F_FULLY_QUALIFIED | JavaElementLabels.M_FULLY_QUALIFIED | JavaElementLabels.I_FULLY_QUALIFIED | JavaElementLabels.M_PARAMETER_TYPES | JavaElementLabels.T_FULLY_QUALIFIED | JavaElementLabels.D_QUALIFIED | JavaElementLabels.CF_QUALIFIED | JavaElementLabels.CU_QUALIFIED; flags |= JavaElementLabels.PREPEND_ROOT_PATH; } fLabelProvider.setTextFlags(flags); } private IJavaElement getJavaElement(Object o) { if (o instanceof IJavaElement) return (IJavaElement)o; if (!(o instanceof ISearchResultViewEntry)) return null; IMarker marker= getMarker(o); if (marker == null || !marker.exists()) return null; return getJavaElement(marker); } protected IMarker getMarker(Object o) { if (!(o instanceof ISearchResultViewEntry)) return null; return ((ISearchResultViewEntry)o).getSelectedMarker(); } private IJavaElement getJavaElement(IMarker marker) { if (fLastMarker != marker) { fLastJavaElement= SearchUtil.getJavaElement(marker); fLastMarker= marker; } return fLastJavaElement; } public void addListener(ILabelProviderListener listener) { super.addListener(listener); fLabelProvider.addListener(listener); } public void dispose() { super.dispose(); fLabelProvider.dispose(); } public boolean isLabelProperty(Object element, String property) { return fLabelProvider.isLabelProperty(element, property); } public void removeListener(ILabelProviderListener listener) { super.removeListener(listener); fLabelProvider.removeListener(listener); } }
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
org.eclipse.jdt.ui/core
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/CompositeChange.java
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
org.eclipse.jdt.ui/core
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/base/ICompositeChange.java
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
org.eclipse.jdt.ui/ui
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/ChangeElementTreeViewer.java
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
org.eclipse.jdt.ui/ui
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/DefaultChangeElement.java
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
org.eclipse.jdt.ui/ui
27,988
Bug 27988 checkbox tree behavior in refactoring not consistent
In at least the rename-refactor wizard, after the changes have been identified, the "changes to be performed" tree's checkboxes exhibit the following behavior: Clear a task, and expand its sub-tasks. check one of the sub-tasks. This causes the super-task to be a grey 'partial-type' checkbox (expected) immediately clear that sub-task. This leaves no sub-tasks selected, but the super-task is still grey, indicating it is partially selected. This may relate to a checkbox-tree SWT widget, rather than this dialog in particular.
resolved fixed
0f843d6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-20T16:57:53Z
2002-12-10T00:26:40Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/PreviewWizardPage.java
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
org.eclipse.jdt.ui/core
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/UndoManager.java
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
org.eclipse.jdt.ui/ui
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/PerformChangeOperation.java
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
org.eclipse.jdt.ui/ui
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/PerformRefactoringUtil.java
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
org.eclipse.jdt.ui/ui
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/RefactoringWizard.java
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
org.eclipse.jdt.ui/ui
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/actions/PerformRefactoringUtil.java
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
org.eclipse.jdt.ui/ui
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/actions/RefactoringStarter.java
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaStatusConstants.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ package org.eclipse.jdt.internal.ui; /** * Defines status codes relevant to the Java UI plug-in. When a * Core exception is thrown, it contain a status object describing * the cause of the exception. The status objects originating from the * Java UI plug-in use the codes defined in this interface. */ public interface IJavaStatusConstants { // Java UI status constants start at 10000 to make sure that we don't // collide with resource and java model constants. public static final int INTERNAL_ERROR= 10001; /** * Status constant indicating that an exception occured on * storing or loading templates. */ public static final int TEMPLATE_IO_EXCEPTION = 10002; /** * Status constant indication that an validateEdit call has * changed the content of a file on disk. */ public static final int VALIDATE_EDIT_CHANGED_CONTENT= 10003; }
26,501
Bug 26501 Refactoring wizard brings the package explorer to flicker [refactoring]
20021114 1. In the Java perspective, package explorer visible. 2. Open FilterDescriptor (jdt.ui) select ID_PLUGIN (line 76). 3. From the context menu choose Refactoring -> Inline Constant 4. On the first page press next 5. Before the progress monitor is finished, the package view suddenly starts to flicker for about 1/2 sec. Why?
resolved fixed
62edf84
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T11:21:55Z
2002-11-15T17:06:40Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java
/******************************************************************************* * Copyright (c) 2002 International Business Machines Corp. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v05.html * * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.jdt.ui; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.ui.texteditor.AbstractTextEditor; import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.ui.text.IJavaColorConstants; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage; /** * Preference constants used in the JDT-UI preference store. Clients should only read the * JDT-UI preference store using these values. Clients are not allowed to modify the * preference store programmatically. * * @since 2.0 */ public class PreferenceConstants { private PreferenceConstants() { } /** * A named preference that controls return type rendering of methods in the UI. * <p> * Value is of type <code>Boolean</code>: if <code>true</code> return types * are rendered * </p> */ public static final String APPEARANCE_METHOD_RETURNTYPE= "org.eclipse.jdt.ui.methodreturntype";//$NON-NLS-1$ /** * A named preference that controls if override indicators are rendered in the UI. * <p> * Value is of type <code>Boolean</code>: if <code>true</code> override * indicators are rendered * </p> */ public static final String APPEARANCE_OVERRIDE_INDICATOR= "org.eclipse.jdt.ui.overrideindicator";//$NON-NLS-1$ /** * A named preference that defines the pattern used for package name compression. * <p> * Value is of type <code>String</code>. For example foe the given package name 'org.eclipse.jdt' pattern * '.' will compress it to '..jdt', '1~' to 'o~.e~.jdt'. * </p> */ public static final String APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW= "PackagesView.pkgNamePatternForPackagesView";//$NON-NLS-1$ /** * A named preference that controls if package name compression is turned on or off. * <p> * Value is of type <code>Boolean</code>. * </p> * * @see #APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW */ public static final String APPEARANCE_COMPRESS_PACKAGE_NAMES= "org.eclipse.jdt.ui.compresspackagenames";//$NON-NLS-1$ /** * A named preference that controls if empty inner packages are folded in * the hierarchical mode of the package explorer. * <p> * Value is of type <code>Boolean</code>: if <code>true</code> empty * inner packages are folded. * </p> * @since 2.1 */ public static final String APPEARANCE_FOLD_PACKAGES_IN_PACKAGE_EXPLORER= "org.eclipse.jdt.ui.flatPackagesInPackageExplorer";//$NON-NLS-1$ /** * A named preference that defines how member elements are ordered by the * Java views using the <code>JavaElementSorter</code>. * <p> * Value is of type <code>String</code>: A comma separated list of the * following entries. Each entry must be in the list, no duplication. List * order defines the sort order. * <ul> * <li><b>T</b>: Types</li> * <li><b>C</b>: Constructors</li> * <li><b>I</b>: Initializers</li> * <li><b>M</b>: Methods</li> * <li><b>F</b>: Fields</li> * <li><b>SI</b>: Static Initializers</li> * <li><b>SM</b>: Static Methods</li> * <li><b>SF</b>: Static Fields</li> * </ul> * </p> * @since 2.1 */ public static final String APPEARANCE_MEMBER_SORT_ORDER= "outlinesortoption"; //$NON-NLS-1$ /** * A named preference that controls if prefix removal during setter/getter generation is turned on or off. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String CODEGEN_USE_GETTERSETTER_PREFIX= "org.eclipse.jdt.ui.gettersetter.prefix.enable";//$NON-NLS-1$ /** * A named preference that holds a list of prefixes to be removed from a local variable to compute setter * and gettter names. * <p> * Value is of type <code>String</code>: comma separated list of prefixed * </p> * * @see #CODEGEN_USE_GETTERSETTER_PREFIX */ public static final String CODEGEN_GETTERSETTER_PREFIX= "org.eclipse.jdt.ui.gettersetter.prefix.list";//$NON-NLS-1$ /** * A named preference that controls if suffix removal during setter/getter generation is turned on or off. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String CODEGEN_USE_GETTERSETTER_SUFFIX= "org.eclipse.jdt.ui.gettersetter.suffix.enable";//$NON-NLS-1$ /** * A named preference that holds a list of suffixes to be removed from a local variable to compute setter * and getter names. * <p> * Value is of type <code>String</code>: comma separated list of suffixes * </p> * * @see #CODEGEN_USE_GETTERSETTER_SUFFIX */ public static final String CODEGEN_GETTERSETTER_SUFFIX= "org.eclipse.jdt.ui.gettersetter.suffix.list"; //$NON-NLS-1$ /** * A name preference that controls if a JavaDoc stub gets added to newly created types and methods. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String CODEGEN__JAVADOC_STUBS= "org.eclipse.jdt.ui.javadoc"; //$NON-NLS-1$ /** * A named preference that controls if a non-javadoc comment gets added to methods generated via the * "Override Methods" operation. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String CODEGEN__NON_JAVADOC_COMMENTS= "org.eclipse.jdt.ui.seecomments"; //$NON-NLS-1$ /** * A named preference that controls if a file comment gets added to newly created files. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String CODEGEN__FILE_COMMENTS= "org.eclipse.jdt.ui.filecomments"; //$NON-NLS-1$ /** * A named preference that holds a list of comma separated package names. The list specifies the import order used by * the "Organize Imports" opeation. * <p> * Value is of type <code>String</code>: semicolon separated list of package * names * </p> */ public static final String ORGIMPORTS_IMPORTORDER= "org.eclipse.jdt.ui.importorder"; //$NON-NLS-1$ /** * A named preference that specifies the number of imports added before a star-import declaration is used. * <p> * Value is of type <code>Int</code>: positive value specifing the number of non star-import is used * </p> */ public static final String ORGIMPORTS_ONDEMANDTHRESHOLD= "org.eclipse.jdt.ui.ondemandthreshold"; //$NON-NLS-1$ /** * A named preferences that controls if types that start with a lower case letters get added by the * "Organize Import" operation. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String ORGIMPORTS_IGNORELOWERCASE= "org.eclipse.jdt.ui.ignorelowercasenames"; //$NON-NLS-1$ /** * A named preference that speficies whether children of a compilation unit are shown in the package explorer. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String SHOW_CU_CHILDREN= "org.eclipse.jdt.ui.packages.cuchildren"; //$NON-NLS-1$ /** * A named preference that controls whether the package explorer's selection is linked to the active editor. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String LINK_PACKAGES_TO_EDITOR= "org.eclipse.jdt.ui.packages.linktoeditor"; //$NON-NLS-1$ /** * A named preference that controls whether the hierarchy view's selection is linked to the active editor. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String LINK_TYPEHIERARCHY_TO_EDITOR= "org.eclipse.jdt.ui.packages.linktypehierarchytoeditor"; //$NON-NLS-1$ /** * A named preference that controls whether the browsing view's selection is * linked to the active editor. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public static final String LINK_BROWSING_VIEW_TO_EDITOR= "org.eclipse.jdt.ui.browsing.linktoeditor"; //$NON-NLS-1$ /** * A named preference that controls whether new projects are generated using source and output folder. * <p> * Value is of type <code>Boolean</code>. if <code>true</code> new projects are created with a source and * output folder. If <code>false</code> source and output folder equals to the project. * </p> */ public static final String SRCBIN_FOLDERS_IN_NEWPROJ= "org.eclipse.jdt.ui.wizards.srcBinFoldersInNewProjects"; //$NON-NLS-1$ /** * A named preference that specifies the source folder name used when creating a new Java project. Value is inactive * if <code>SRCBIN_FOLDERS_IN_NEWPROJ</code> is set to <code>false</code>. * <p> * Value is of type <code>String</code>. * </p> * * @see #SRCBIN_FOLDERS_IN_NEWPROJ */ public static final String SRCBIN_SRCNAME= "org.eclipse.jdt.ui.wizards.srcBinFoldersSrcName"; //$NON-NLS-1$ /** * A named preference that specifies the output folder name used when creating a new Java project. Value is inactive * if <code>SRCBIN_FOLDERS_IN_NEWPROJ</code> is set to <code>false</code>. * <p> * Value is of type <code>String</code>. * </p> * * @see #SRCBIN_FOLDERS_IN_NEWPROJ */ public static final String SRCBIN_BINNAME= "org.eclipse.jdt.ui.wizards.srcBinFoldersBinName"; //$NON-NLS-1$ /** * A named preference that holds a list of possible JRE libraries used by the New Java Project wizard. An library * consists of a description and an arbitrary number of <code>IClasspathEntry</code>s, that will represent the * JRE on the new project's classpath. * <p> * Value is of type <code>String</code>: a semicolon separated list of encoded JRE libraries. * <code>NEWPROJECT_JRELIBRARY_INDEX</code> defines the currently used library. Clients * should use the method <code>encodeJRELibrary</code> to encode a JRE library into a string * and the methods <code>decodeJRELibraryDescription(String)</code> and <code> * decodeJRELibraryClasspathEntries(String)</code> to decode the description and the array * of classpath entries from an encoded string. * </p> * * @see #NEWPROJECT_JRELIBRARY_INDEX * @see #encodeJRELibrary(String, IClasspathEntry[]) * @see #decodeJRELibraryDescription(String) * @see #decodeJRELibraryClasspathEntries(String) */ public static final String NEWPROJECT_JRELIBRARY_LIST= "org.eclipse.jdt.ui.wizards.jre.list"; //$NON-NLS-1$ /** * A named preferences that specifies the current active JRE library. * <p> * Value is of type <code>Int</code>: an index into the list of possible JRE libraries. * </p> * * @see #NEWPROJECT_JRELIBRARY_LIST */ public static final String NEWPROJECT_JRELIBRARY_INDEX= "org.eclipse.jdt.ui.wizards.jre.index"; //$NON-NLS-1$ /** * A named preference that controls if a new type hierarchy gets opened in a * new type hierarchy perspective or inside the type hierarchy view part. * <p> * Value is of type <code>String</code>: possible values are <code> * OPEN_TYPE_HIERARCHY_IN_PERSPECTIVE</code> or <code> * OPEN_TYPE_HIERARCHY_IN_VIEW_PART</code>. * </p> * * @see #OPEN_TYPE_HIERARCHY_IN_PERSPECTIVE * @see #OPEN_TYPE_HIERARCHY_IN_VIEW_PART */ public static final String OPEN_TYPE_HIERARCHY= "org.eclipse.jdt.ui.openTypeHierarchy"; //$NON-NLS-1$ /** * A string value used by the named preference <code>OPEN_TYPE_HIERARCHY</code>. * * @see #OPEN_TYPE_HIERARCHY */ public static final String OPEN_TYPE_HIERARCHY_IN_PERSPECTIVE= "perspective"; //$NON-NLS-1$ /** * A string value used by the named preference <code>OPEN_TYPE_HIERARCHY</code>. * * @see #OPEN_TYPE_HIERARCHY */ public static final String OPEN_TYPE_HIERARCHY_IN_VIEW_PART= "viewPart"; //$NON-NLS-1$ /** * A named preference that controls the behaviour when double clicking on a container in the packages view. * <p> * Value is of type <code>String</code>: possible values are <code> * DOUBLE_CLICK_GOES_INTO</code> or <code> * DOUBLE_CLICK_EXPANDS</code>. * </p> * * @see #DOUBLE_CLICK_EXPANDS * @see #DOUBLE_CLICK_GOES_INTO */ public static final String DOUBLE_CLICK= "packageview.doubleclick"; //$NON-NLS-1$ /** * A string value used by the named preference <code>DOUBLE_CLICK</code>. * * @see #DOUBLE_CLICK */ public static final String DOUBLE_CLICK_GOES_INTO= "packageview.gointo"; //$NON-NLS-1$ /** * A string value used by the named preference <code>DOUBLE_CLICK</code>. * * @see #DOUBLE_CLICK */ public static final String DOUBLE_CLICK_EXPANDS= "packageview.doubleclick.expands"; //$NON-NLS-1$ /** * A named preference that controls whether Java views update their presentation while editing or when saving the * content of an editor. * <p> * Value is of type <code>String</code>: possible values are <code> * UPDATE_ON_SAVE</code> or <code> * UPDATE_WHILE_EDITING</code>. * </p> * * @see #UPDATE_ON_SAVE * @see #UPDATE_WHILE_EDITING */ public static final String UPDATE_JAVA_VIEWS= "JavaUI.update"; //$NON-NLS-1$ /** * A string value used by the named preference <code>UPDATE_JAVA_VIEWS</code> * * @see #UPDATE_JAVA_VIEWS */ public static final String UPDATE_ON_SAVE= "JavaUI.update.onSave"; //$NON-NLS-1$ /** * A string value used by the named preference <code>UPDATE_JAVA_VIEWS</code> * * @see #UPDATE_JAVA_VIEWS */ public static final String UPDATE_WHILE_EDITING= "JavaUI.update.whileEditing"; //$NON-NLS-1$ /** * A named preference that holds the path of the Javadoc command used by the Javadoc creation wizard. * <p> * Value is of type <code>String</code>. * </p> */ public static final String JAVADOC_COMMAND= "command"; //$NON-NLS-1$ /** * A named preference that controls whether bracket matching highlighting is turned on or off. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_MATCHING_BRACKETS= "matchingBrackets"; //$NON-NLS-1$ /** * A named preference that holds the color used to highlight matching brackets. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_MATCHING_BRACKETS_COLOR= "matchingBracketsColor"; //$NON-NLS-1$ /** * A named preference that controls whether the current line highlighting is turned on or off. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_CURRENT_LINE= "currentLine"; //$NON-NLS-1$ /** * A named preference that holds the color used to highlight the current line. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_CURRENT_LINE_COLOR= "currentLineColor"; //$NON-NLS-1$ /** * A named preference that controls whether the print margin is turned on or off. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_PRINT_MARGIN= "printMargin"; //$NON-NLS-1$ /** * A named preference that holds the color used to render the print margin. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_PRINT_MARGIN_COLOR= "printMarginColor"; //$NON-NLS-1$ /** * Print margin column. Int value. */ public final static String EDITOR_PRINT_MARGIN_COLUMN= "printMarginColumn"; //$NON-NLS-1$ /** * A named preference that holds the color used for the find/replace scope. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_FIND_SCOPE_COLOR= AbstractTextEditor.PREFERENCE_COLOR_FIND_SCOPE; /** * A named preference that specifies if the editor uses spaces for tabs. * <p> * Value is of type <code>Boolean</code>. If <code>true</code>spaces instead of tabs are used * in the editor. If <code>false</code> the editor inserts a tab character when pressing the tab * key. * </p> */ public final static String EDITOR_SPACES_FOR_TABS= "spacesForTabs"; //$NON-NLS-1$ /** * A named preference that holds the number of spaces used per tab in the editor. * <p> * Value is of type <code>Int</code>: positive int value specifying the number of * spaces per tab. * </p> */ public final static String EDITOR_TAB_WIDTH= "org.eclipse.jdt.ui.editor.tab.width"; //$NON-NLS-1$ /** * A named preference that controls whether the outline view selection * should stay in sync with with the element at the current cursor position. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE= "JavaEditor.SyncOutlineOnCursorMove"; //$NON-NLS-1$ /** * A named preference that controls if correction indicators are shown in the UI. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_CORRECTION_INDICATION= "JavaEditor.ShowTemporaryProblem"; //$NON-NLS-1$ /** * A named preference that controls whether the editor shows problem indicators in text (squiggly lines). * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_PROBLEM_INDICATION= "problemIndication"; //$NON-NLS-1$ /** * A named preference that holds the color used to render problem indicators. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see #EDITOR_PROBLEM_INDICATION * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_PROBLEM_INDICATION_COLOR= "problemIndicationColor"; //$NON-NLS-1$ /**PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR; * A named preference that controls whether the editor shows warning indicators in text (squiggly lines). * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_WARNING_INDICATION= "warningIndication"; //$NON-NLS-1$ /** * A named preference that holds the color used to render warning indicators. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see #EDITOR_WARNING_INDICATION * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_WARNING_INDICATION_COLOR= "warningIndicationColor"; //$NON-NLS-1$ /** * A named preference that controls whether the editor shows task indicators in text (squiggly lines). * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_TASK_INDICATION= "taskIndication"; //$NON-NLS-1$ /** * A named preference that holds the color used to render task indicators. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see #EDITOR_TASK_INDICATION * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_TASK_INDICATION_COLOR= "taskIndicationColor"; //$NON-NLS-1$ /** * A named preference that controls whether the editor shows bookmark * indicators in text (squiggly lines). * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_BOOKMARK_INDICATION= "bookmarkIndication"; //$NON-NLS-1$ /** * A named preference that holds the color used to render bookmark indicators. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see #EDITOR_BOOKMARK_INDICATION * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter * @since 2.1 */ public final static String EDITOR_BOOKMARK_INDICATION_COLOR= "bookmarkIndicationColor"; //$NON-NLS-1$ /** * A named preference that controls whether the editor shows search * indicators in text (squiggly lines). * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_SEARCH_RESULT_INDICATION= "searchResultIndication"; //$NON-NLS-1$ /** * A named preference that holds the color used to render search indicators. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see #EDITOR_SEARCH_RESULT_INDICATION * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter * @since 2.1 */ public final static String EDITOR_SEARCH_RESULT_INDICATION_COLOR= "searchResultIndicationColor"; //$NON-NLS-1$ /** * A named preference that controls whether the editor shows unknown * indicators in text (squiggly lines). * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_UNKNOWN_INDICATION= "othersIndication"; //$NON-NLS-1$ /** * A named preference that holds the color used to render unknown * indicators. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see #EDITOR_UNKNOWN_INDICATION * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter * @since 2.1 */ public final static String EDITOR_UNKNOWN_INDICATION_COLOR= "othersIndicationColor"; //$NON-NLS-1$ /** * A named preference that controls whether the overview ruler shows error * indicators. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER= "errorIndicationInOverviewRuler"; //$NON-NLS-1$ /** * A named preference that controls whether the overview ruler shows warning * indicators. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER= "warningIndicationInOverviewRuler"; //$NON-NLS-1$ /** * A named preference that controls whether the overview ruler shows task * indicators. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER= "taskIndicationInOverviewRuler"; //$NON-NLS-1$ /** * A named preference that controls whether the overview ruler shows * bookmark indicators. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER= "bookmarkIndicationInOverviewRuler"; //$NON-NLS-1$ /** * A named preference that controls whether the overview ruler shows * search result indicators. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER= "searchResultIndicationInOverviewRuler"; //$NON-NLS-1$ /** * A named preference that controls whether the overview ruler shows * unknown indicators. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER= "othersIndicationInOverviewRuler"; //$NON-NLS-1$ /** * A named preference that controls whether the 'close strings' feature * is enabled. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_CLOSE_STRINGS= "closeStrings"; //$NON-NLS-1$ /** * A named preference that controls whether the 'wrap strings' feature is * enabled. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_WRAP_STRINGS= "wrapStrings"; //$NON-NLS-1$ /** * A named preference that controls whether the 'close brackets' feature is * enabled. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_CLOSE_BRACKETS= "closeBrackets"; //$NON-NLS-1$ /** * A named preference that controls whether the 'close braces' feature is * enabled. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_CLOSE_BRACES= "closeBraces"; //$NON-NLS-1$ /** * A named preference that controls whether the 'close java docs' feature is * enabled. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_CLOSE_JAVADOCS= "closeJavaDocs"; //$NON-NLS-1$ /** * A named preference that controls whether the 'add JavaDoc tags' feature * is enabled. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_ADD_JAVADOC_TAGS= "addJavaDocTags"; //$NON-NLS-1$ /** * A named preference that controls whether the 'format Javadoc tags' * feature is enabled. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_FORMAT_JAVADOCS= "formatJavaDocs"; //$NON-NLS-1$ /** * A named preference that controls whether the 'smart paste' feature is * enabled. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_SMART_PASTE= "smartPaste"; //$NON-NLS-1$ /** * A named preference that controls whether the 'smart home-end' feature is * enabled. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String EDITOR_SMART_HOME_END= AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END; /** * A named preference that controls if temporary problems are evaluated and shown in the UI. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_EVALUTE_TEMPORARY_PROBLEMS= "handleTemporaryProblems"; //$NON-NLS-1$ /** * A named preference that controls if the overview ruler is shown in the UI. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_OVERVIEW_RULER= "overviewRuler"; //$NON-NLS-1$ /** * A named preference that controls if the line number ruler is shown in the UI. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_LINE_NUMBER_RULER= "lineNumberRuler"; //$NON-NLS-1$ /** * A named preference that holds the color used to render line numbers inside the line number ruler. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter * @see #EDITOR_LINE_NUMBER_RULER */ public final static String EDITOR_LINE_NUMBER_RULER_COLOR= "lineNumberColor"; //$NON-NLS-1$ /** * A named preference that holds the color used to render linked positions inside code templates. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_LINKED_POSITION_COLOR= "linkedPositionColor"; //$NON-NLS-1$ /** * A named preference that holds the color used as the text foreground. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_FOREGROUND_COLOR= AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND; /** * A named preference that describes if the system default foreground color * is used as the text foreground. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_FOREGROUND_DEFAULT_COLOR= AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT; /** * A named preference that holds the color used as the text background. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_BACKGROUND_COLOR= AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND; /** * A named preference that describes if the system default background color * is used as the text foreground. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_BACKGROUND_DEFAULT_COLOR= AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT; /** * Preference key suffix for bold text style preference keys. */ public static final String EDITOR_BOLD_SUFFIX= "_bold"; //$NON-NLS-1$ /** * A named preference that holds the color used to render multi line comments. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_MULTI_LINE_COMMENT_COLOR= IJavaColorConstants.JAVA_MULTI_LINE_COMMENT; /** * The symbolic font name for the Java editor text font * (value <code>"org.eclipse.jdt.ui.editors.textfont"</code>). * * @since 2.1 */ public final static String EDITOR_TEXT_FONT= "org.eclipse.jdt.ui.editors.textfont"; //$NON-NLS-1$ /** * A named preference that controls whether multi line comments are rendered in bold. * <p> * Value is of type <code>Boolean</code>. If <code>true</code> multi line comments are rendered * in bold. If <code>false</code> the are rendered using no font style attribute. * </p> */ public final static String EDITOR_MULTI_LINE_COMMENT_BOLD= IJavaColorConstants.JAVA_MULTI_LINE_COMMENT + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render single line comments. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_SINGLE_LINE_COMMENT_COLOR= IJavaColorConstants.JAVA_SINGLE_LINE_COMMENT; /** * A named preference that controls whether sinle line comments are rendered in bold. * <p> * Value is of type <code>Boolean</code>. If <code>true</code> single line comments are rendered * in bold. If <code>false</code> the are rendered using no font style attribute. * </p> */ public final static String EDITOR_SINGLE_LINE_COMMENT_BOLD= IJavaColorConstants.JAVA_SINGLE_LINE_COMMENT + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render java keywords. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_JAVA_KEYWORD_COLOR= IJavaColorConstants.JAVA_KEYWORD; /** * A named preference that controls whether keywords are rendered in bold. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_JAVA_KEYWORD_BOLD= IJavaColorConstants.JAVA_KEYWORD + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render string constants. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_STRING_COLOR= IJavaColorConstants.JAVA_STRING; /** * A named preference that controls whether string constants are rendered in bold. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_STRING_BOLD= IJavaColorConstants.JAVA_STRING + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render java default text. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_JAVA_DEFAULT_COLOR= IJavaColorConstants.JAVA_DEFAULT; /** * A named preference that controls whether Java default text is rendered in bold. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_JAVA_DEFAULT_BOLD= IJavaColorConstants.JAVA_DEFAULT + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render javadoc keywords. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_JAVADOC_KEYWORD_COLOR= IJavaColorConstants.JAVADOC_KEYWORD; /** * A named preference that controls whether javadoc keywords are rendered in bold. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_JAVADOC_KEYWORD_BOLD= IJavaColorConstants.JAVADOC_KEYWORD + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render javadoc tags. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_JAVADOC_TAG_COLOR= IJavaColorConstants.JAVADOC_TAG; /** * A named preference that controls whether javadoc tags are rendered in bold. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_JAVADOC_TAG_BOLD= IJavaColorConstants.JAVADOC_TAG + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render javadoc links. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_JAVADOC_LINKS_COLOR= IJavaColorConstants.JAVADOC_LINK; /** * A named preference that controls whether javadoc links are rendered in bold. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_JAVADOC_LINKS_BOLD= IJavaColorConstants.JAVADOC_LINK + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render javadoc default text. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String EDITOR_JAVADOC_DEFAULT_COLOR= IJavaColorConstants.JAVADOC_DEFAULT; /** * A named preference that controls whether javadoc default text is rendered in bold. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String EDITOR_JAVADOC_DEFAULT_BOLD= IJavaColorConstants.JAVADOC_DEFAULT + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used for 'linked-mode' underline. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter * @since 2.1 */ public final static String EDITOR_LINK_COLOR= "linkColor"; //$NON-NLS-1$ /** * A named preference that controls whether hover tooltips in the editor are turned on or off. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String EDITOR_SHOW_HOVER= "org.eclipse.jdt.ui.editor.showHover"; //$NON-NLS-1$ /** * A named preference that defines the hover shown when no control key is * pressed. * <p>Value is of type <code>String</code>: possible values are <code> * EDITOR_NO_HOVER_CONFIGURED_ID</code> or * <code>EDITOR_DEFAULT_HOVER_CONFIGURED_ID</code> or the hover id of a hover * contributed as <code>javaEditorTextHovers</code>. * </p> * @see #EDITOR_NO_HOVER_CONFIGURED_ID * @see #EDITOR_DEFAULT_HOVER_CONFIGURED_ID * @see JavaUI * @since 2.1 */ public static final String EDITOR_NONE_HOVER= "noneHover"; //$NON-NLS-1$ /** * A named preference that defines the hover shown when the * <code>CTRL</code> modifier key is pressed. * <p>Value is of type <code>String</code>: possible values are <code> * EDITOR_NO_HOVER_CONFIGURED_ID</code> or * <code>EDITOR_DEFAULT_HOVER_CONFIGURED_ID</code> or the hover id of a * hover contributed as <code>javaEditorTextHovers</code>. * </p> * @see #EDITOR_NO_HOVER_CONFIGURED_ID * @see #EDITOR_DEFAULT_HOVER_CONFIGURED_ID * @see JavaUI * @since 2.1 */ public static final String EDITOR_CTRL_HOVER= "ctrlHover"; //$NON-NLS-1$ /** * A named preference that defines the hover shown when the * <code>SHIFT</code> modifier key is pressed. * <p>Value is of type <code>String</code>: possible values are <code> * EDITOR_NO_HOVER_CONFIGURED_ID</code> or * <code>EDITOR_DEFAULT_HOVER_CONFIGURED_ID</code> or the hover id of a * hover contributed as <code>javaEditorTextHovers</code>. * </p> * @see #EDITOR_NO_HOVER_CONFIGURED_ID * @see #EDITOR_DEFAULT_HOVER_CONFIGURED_ID * @see JavaUI ID_*_HOVER * @since 2.1 */ public static final String EDITOR_SHIFT_HOVER= "shiftHover"; //$NON-NLS-1$ /** * A named preference that defines the hover shown when the * <code>CTRL + ALT</code> modifier keys is pressed. * <p>Value is of type <code>String</code>: possible values are <code> * EDITOR_NO_HOVER_CONFIGURED_ID</code> or * <code>EDITOR_DEFAULT_HOVER_CONFIGURED_ID</code> or the hover id of a * hover contributed as <code>javaEditorTextHovers</code>. * </p> * @see #EDITOR_NO_HOVER_CONFIGURED_ID * @see #EDITOR_DEFAULT_HOVER_CONFIGURED_ID * @see JavaUI ID_*_HOVER * @since 2.1 */ public static final String EDITOR_CTRL_ALT_HOVER= "ctrlAltHover"; //$NON-NLS-1$ /** * A named preference that defines the hover shown when the * <code>CTRL + ALT + SHIFT</code> modifier keys is pressed. * <p>Value is of type <code>String</code>: possible values are <code> * EDITOR_NO_HOVER_CONFIGURED_ID</code> or * <code>EDITOR_DEFAULT_HOVER_CONFIGURED_ID</code> or the hover id of a * hover contributed as <code>javaEditorTextHovers</code>. * </p> * @see #EDITOR_NO_HOVER_CONFIGURED_ID * @see #EDITOR_DEFAULT_HOVER_CONFIGURED_ID * @see JavaUI ID_*_HOVER * @since 2.1 */ public static final String EDITOR_CTRL_ALT_SHIFT_HOVER= "ctrlAltShiftHover"; //$NON-NLS-1$ /** * A named preference that defines the hover shown when the * <code>CTRL + SHIFT</code> modifier keys is pressed. * <p>Value is of type <code>String</code>: possible values are <code> * EDITOR_NO_HOVER_CONFIGURED_ID</code> or * <code>EDITOR_DEFAULT_HOVER_CONFIGURED_ID</code> or the hover id of a * hover contributed as <code>javaEditorTextHovers</code>. * </p> * @see #EDITOR_NO_HOVER_CONFIGURED_ID * @see #EDITOR_DEFAULT_HOVER_CONFIGURED_ID * @see JavaUI ID_*_HOVER * @since 2.1 */ public static final String EDITOR_CTRL_SHIFT_HOVER= "ctrlShiftHover"; //$NON-NLS-1$ /** * A named preference that defines the hover shown when the * <code>ALT</code> modifier key is pressed. * <p>Value is of type <code>String</code>: possible values are <code> * EDITOR_NO_HOVER_CONFIGURED_ID</code>, * <code>EDITOR_DEFAULT_HOVER_CONFIGURED_ID</code> or the hover id of a * hover contributed as <code>javaEditorTextHovers</code>. * </p> * @see #EDITOR_NO_HOVER_CONFIGURED_ID * @see #EDITOR_DEFAULT_HOVER_CONFIGURED_ID * @see JavaUI ID_*_HOVER * @since 2.1 */ public static final String EDITOR_ALT_SHIFT_HOVER= "altShiftHover"; //$NON-NLS-1$ /** * A string value used by the named preferences for hover configuration to * descibe that no hover should be shown for the given key modifiers. * @since 2.1 */ public static final String EDITOR_NO_HOVER_CONFIGURED_ID= "noHoverConfiguredId"; //$NON-NLS-1$ /** * A string value used by the named preferences for hover configuration to * descibe that the default hover should be shown for the given key * modifiers. The default hover is described by the * <code>EDITOR_DEFAULT_HOVER</code> property. * @since 2.1 */ public static final String EDITOR_DEFAULT_HOVER_CONFIGURED_ID= "defaultHoverConfiguredId"; //$NON-NLS-1$ /** * A named preference that defines the hover named the 'default hover'. * Value is of type <code>String</code>: possible values are <code> * EDITOR_NO_HOVER_CONFIGURED_ID</code> or <code> the hover id of a hover * contributed as <code>javaEditorTextHovers</code>. * </p> *@since 2.1 */ public static final String EDITOR_DEFAULT_HOVER= "defaultHover"; //$NON-NLS-1$ /** * A named preference that controls if segmented view (show selected element only) is turned on or off. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String EDITOR_SHOW_SEGMENTS= "org.eclipse.jdt.ui.editor.showSegments"; //$NON-NLS-1$ /** * A named preference that controls if the Java code assist gets auto activated. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String CODEASSIST_AUTOACTIVATION= "content_assist_autoactivation"; //$NON-NLS-1$ /** * A name preference that holds the auto activation delay time in milli seconds. * <p> * Value is of type <code>Int</code>. * </p> */ public final static String CODEASSIST_AUTOACTIVATION_DELAY= "content_assist_autoactivation_delay"; //$NON-NLS-1$ /** * A named preference that controls if code assist contains only visible proposals. * <p> * Value is of type <code>Boolean</code>. if <code>true<code> code assist only contains visible members. If * <code>false</code> all members are included. * </p> */ public final static String CODEASSIST_SHOW_VISIBLE_PROPOSALS= "content_assist_show_visible_proposals"; //$NON-NLS-1$ /** * A named preference that controls if the Java code assist inserts a * proposal automatically if only one proposal is available. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String CODEASSIST_AUTOINSERT= "content_assist_autoinsert"; //$NON-NLS-1$ /** * A named preference that controls if the Java code assist adds import * statements. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String CODEASSIST_ADDIMPORT= "content_assist_add_import"; //$NON-NLS-1$ /** * A named preference that controls if the Java code assist only inserts * completions. If set to false the proposals can also _replace_ code. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String CODEASSIST_INSERT_COMPLETION= "content_assist_insert_completion"; //$NON-NLS-1$ /** * A named preference that controls whether code assist proposals filtering is case sensitive or not. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String CODEASSIST_CASE_SENSITIVITY= "content_assist_case_sensitivity"; //$NON-NLS-1$ /** * A named preference that defines if code assist proposals are sorted in alphabetical order. * <p> * Value is of type <code>Boolean</code>. If <code>true</code> that are sorted in alphabetical * order. If <code>false</code> that are unsorted. * </p> */ public final static String CODEASSIST_ORDER_PROPOSALS= "content_assist_order_proposals"; //$NON-NLS-1$ /** * A named preference that controls if argument names are filled in when a method is selected from as list * of code assist proposal. * <p> * Value is of type <code>Boolean</code>. * </p> */ public final static String CODEASSIST_FILL_ARGUMENT_NAMES= "content_assist_fill_method_arguments"; //$NON-NLS-1$ /** * A named preference that controls if method arguments are guessed when a * method is selected from as list of code assist proposal. * <p> * Value is of type <code>Boolean</code>. * </p> * @since 2.1 */ public final static String CODEASSIST_GUESS_METHOD_ARGUMENTS= "content_assist_guess_method_arguments"; //$NON-NLS-1$ /** * A named preference that holds the characters that auto activate code assist in Java code. * <p> * Value is of type <code>Sring</code>. All characters that trigger auto code assist in Java code. * </p> */ public final static String CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA= "content_assist_autoactivation_triggers_java"; //$NON-NLS-1$ /** * A named preference that holds the characters that auto activate code assist in Javadoc. * <p> * Value is of type <code>Sring</code>. All characters that trigger auto code assist in Javadoc. * </p> */ public final static String CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC= "content_assist_autoactivation_triggers_javadoc"; //$NON-NLS-1$ /** * A named preference that holds the background color used in the code assist selection dialog. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String CODEASSIST_PROPOSALS_BACKGROUND= "content_assist_proposals_background"; //$NON-NLS-1$ /** * A named preference that holds the foreground color used in the code assist selection dialog. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String CODEASSIST_PROPOSALS_FOREGROUND= "content_assist_proposals_foreground"; //$NON-NLS-1$ /** * A named preference that holds the background color used for parameter hints. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String CODEASSIST_PARAMETERS_BACKGROUND= "content_assist_parameters_background"; //$NON-NLS-1$ /** * A named preference that holds the foreground color used in the code assist selection dialog * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ public final static String CODEASSIST_PARAMETERS_FOREGROUND= "content_assist_parameters_foreground"; //$NON-NLS-1$ /** * A named preference that holds the background color used in the code * assist selection dialog to mark replaced code. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter * @since 2.1 */ public final static String CODEASSIST_REPLACEMENT_BACKGROUND= "content_assist_completion_replacement_background"; //$NON-NLS-1$ /** * A named preference that holds the foreground color used in the code * assist selection dialog to mark replaced code. * <p> * Value is of type <code>String</code>. A RGB color value encoded as a string * using class <code>PreferenceConverter</code> * </p> * * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter * @since 2.1 */ public final static String CODEASSIST_REPLACEMENT_FOREGROUND= "content_assist_completion_replacement_foreground"; //$NON-NLS-1$ /** * A named preference that controls the behaviour of the refactoring wizard for showing the error page. * <p> * Value is of type <code>String</code>. Valid values are: * <code>REFACTOR_FATAL_SEVERITY</code>, * <code>REFACTOR_ERROR_SEVERITY</code>, * <code>REFACTOR_WARNING_SEVERITY</code> * <code>REFACTOR_INFO_SEVERITY</code>, * <code>REFACTOR_OK_SEVERITY</code>. * </p> * * @see #REFACTOR_FATAL_SEVERITY * @see #REFACTOR_ERROR_SEVERITY * @see #REFACTOR_WARNING_SEVERITY * @see #REFACTOR_INFO_SEVERITY * @see #REFACTOR_OK_SEVERITY */ public static final String REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD= "Refactoring.ErrorPage.severityThreshold"; //$NON-NLS-1$ /** * A string value used by the named preference <code>REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD</code>. * * @see #REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD */ public static final String REFACTOR_FATAL_SEVERITY= "4"; //$NON-NLS-1$ /** * A string value used by the named preference <code>REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD</code>. * * @see #REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD */ public static final String REFACTOR_ERROR_SEVERITY= "3"; //$NON-NLS-1$ /** * A string value used by the named preference <code>REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD</code>. * * @see #REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD */ public static final String REFACTOR_WARNING_SEVERITY= "2"; //$NON-NLS-1$ /** * A string value used by the named preference <code>REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD</code>. * * @see #REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD */ public static final String REFACTOR_INFO_SEVERITY= "1"; //$NON-NLS-1$ /** * A string value used by the named preference <code>REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD</code>. * * @see #REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD */ public static final String REFACTOR_OK_SEVERITY= "0"; //$NON-NLS-1$ /** * A named preference thet controls whether all dirty editors are automatically saved before a refactoring is * executed. * <p> * Value is of type <code>Boolean</code>. * </p> */ public static final String REFACTOR_SAVE_ALL_EDITORS= "Refactoring.savealleditors"; //$NON-NLS-1$ /** * A named preference that controls if the Java Browsing views are linked to the active editor. * <p> * Value is of type <code>Boolean</code>. * </p> * * @see #LINK_PACKAGES_TO_EDITOR */ public static final String BROWSING_LINK_VIEW_TO_EDITOR= "org.eclipse.jdt.ui.browsing.linktoeditor"; //$NON-NLS-1$ /** * A named preference that controls the layout of the Java Browsing views vertically. Boolean value. * <p> * Value is of type <code>Boolean</code>. If <code>true<code> the views are stacked vertical. * If <code>false</code> they are stacked horizontal. * </p> */ public static final String BROWSING_STACK_VERTICALLY= "org.eclipse.jdt.ui.browsing.stackVertically"; //$NON-NLS-1$ /** * A named preference that controls if templates are formatted when applied. * <p> * Value is of type <code>Boolean</code>. * </p> * * @since 2.1 */ public static final String TEMPLATES_USE_CODEFORMATTER= "org.eclipse.jdt.ui.template.format"; //$NON-NLS-1$ public static void initializeDefaultValues(IPreferenceStore store) { store.setDefault(PreferenceConstants.EDITOR_SHOW_SEGMENTS, false); // JavaBasePreferencePage store.setDefault(PreferenceConstants.LINK_PACKAGES_TO_EDITOR, true); store.setDefault(PreferenceConstants.LINK_TYPEHIERARCHY_TO_EDITOR, false); store.setDefault(PreferenceConstants.LINK_BROWSING_VIEW_TO_EDITOR, true); store.setDefault(PreferenceConstants.OPEN_TYPE_HIERARCHY, PreferenceConstants.OPEN_TYPE_HIERARCHY_IN_VIEW_PART); store.setDefault(PreferenceConstants.DOUBLE_CLICK, PreferenceConstants.DOUBLE_CLICK_EXPANDS); store.setDefault(PreferenceConstants.UPDATE_JAVA_VIEWS, PreferenceConstants.UPDATE_WHILE_EDITING); // AppearancePreferencePage store.setDefault(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES, false); store.setDefault(PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE, false); store.setDefault(PreferenceConstants.SHOW_CU_CHILDREN, true); store.setDefault(PreferenceConstants.APPEARANCE_OVERRIDE_INDICATOR, true); store.setDefault(PreferenceConstants.BROWSING_STACK_VERTICALLY, false); store.setDefault(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW, ""); //$NON-NLS-1$ store.setDefault(PreferenceConstants.APPEARANCE_FOLD_PACKAGES_IN_PACKAGE_EXPLORER, true); // ImportOrganizePreferencePage store.setDefault(PreferenceConstants.ORGIMPORTS_IMPORTORDER, "java;javax;org;com"); //$NON-NLS-1$ store.setDefault(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD, 99); store.setDefault(PreferenceConstants.ORGIMPORTS_IGNORELOWERCASE, true); // ClasspathVariablesPreferencePage // CodeFormatterPreferencePage // CompilerPreferencePage // no initialization needed // RefactoringPreferencePage store.setDefault(PreferenceConstants.REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD, PreferenceConstants.REFACTOR_ERROR_SEVERITY); store.setDefault(PreferenceConstants.REFACTOR_SAVE_ALL_EDITORS, false); store.setDefault("RefactoringUI", "dialog"); // TemplatePreferencePage store.setDefault(PreferenceConstants.TEMPLATES_USE_CODEFORMATTER, true); // CodeGenerationPreferencePage store.setDefault(PreferenceConstants.CODEGEN_USE_GETTERSETTER_PREFIX, false); store.setDefault(PreferenceConstants.CODEGEN_USE_GETTERSETTER_SUFFIX, false); store.setDefault(PreferenceConstants.CODEGEN_GETTERSETTER_PREFIX, "fg, f, _$, _, m_"); //$NON-NLS-1$ store.setDefault(PreferenceConstants.CODEGEN_GETTERSETTER_SUFFIX, "_"); //$NON-NLS-1$ store.setDefault(PreferenceConstants.CODEGEN__JAVADOC_STUBS, true); store.setDefault(PreferenceConstants.CODEGEN__NON_JAVADOC_COMMENTS, false); store.setDefault(PreferenceConstants.CODEGEN__FILE_COMMENTS, false); // MembersOrderPreferencePage store.setDefault(PreferenceConstants.APPEARANCE_MEMBER_SORT_ORDER, "T,SI,SF,SM,I,F,C,M"); //$NON-NLS-1$ // must add here to guarantee that it is the first in the listener list store.addPropertyChangeListener(JavaPlugin.getDefault().getMemberOrderPreferenceCache()); // JavaEditorPreferencePage /* * Ensure that the display is accessed only in the UI thread. * Ensure that there are no side effects of switching the thread. */ final RGB[] rgbs= new RGB[3]; final Display display= Display.getDefault(); display.syncExec(new Runnable() { public void run() { Color c= display.getSystemColor(SWT.COLOR_GRAY); rgbs[0]= c.getRGB(); c= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND); rgbs[1]= c.getRGB(); c= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); rgbs[2]= c.getRGB(); } }); store.setDefault(PreferenceConstants.EDITOR_MATCHING_BRACKETS, true); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR, rgbs[0]); store.setDefault(PreferenceConstants.EDITOR_CURRENT_LINE, true); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_CURRENT_LINE_COLOR, new RGB(225, 235, 224)); store.setDefault(PreferenceConstants.EDITOR_PRINT_MARGIN, false); store.setDefault(PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 80); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, new RGB(176, 180 , 185)); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_FIND_SCOPE_COLOR, new RGB(185, 176 , 180)); store.setDefault(PreferenceConstants.EDITOR_PROBLEM_INDICATION, true); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR, new RGB(255, 0 , 128)); store.setDefault(PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER, true); store.setDefault(PreferenceConstants.EDITOR_WARNING_INDICATION, true); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR, new RGB(244, 200 , 45)); store.setDefault(PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER, true); store.setDefault(PreferenceConstants.EDITOR_TASK_INDICATION, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR, new RGB(0, 128, 255)); store.setDefault(PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER, false); store.setDefault(PreferenceConstants.EDITOR_BOOKMARK_INDICATION, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR, new RGB(34, 164, 99)); store.setDefault(PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER, false); store.setDefault(PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR, new RGB(192, 192, 192)); store.setDefault(PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER, false); store.setDefault(PreferenceConstants.EDITOR_UNKNOWN_INDICATION, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR, new RGB(0, 0, 0)); store.setDefault(PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER, false); store.setDefault(PreferenceConstants.EDITOR_CORRECTION_INDICATION, true); store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, false); store.setDefault(PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, true); store.setDefault(PreferenceConstants.EDITOR_OVERVIEW_RULER, true); store.setDefault(PreferenceConstants.EDITOR_LINE_NUMBER_RULER, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, new RGB(0, 0, 0)); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_LINKED_POSITION_COLOR, new RGB(0, 200 , 100)); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_LINK_COLOR, new RGB(0, 0, 255)); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_FOREGROUND_COLOR, rgbs[1]); store.setDefault(PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR, true); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_BACKGROUND_COLOR, rgbs[2]); store.setDefault(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, true); store.setDefault(PreferenceConstants.EDITOR_TAB_WIDTH, 4); store.setDefault(PreferenceConstants.EDITOR_SPACES_FOR_TABS, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR, new RGB(63, 127, 95)); store.setDefault(PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR, new RGB(63, 127, 95)); store.setDefault(PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR, new RGB(127, 0, 85)); store.setDefault(PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD, true); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_STRING_COLOR, new RGB(42, 0, 255)); store.setDefault(PreferenceConstants.EDITOR_STRING_BOLD, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR, new RGB(0, 0, 0)); store.setDefault(PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR, new RGB(127, 159, 191)); store.setDefault(PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD, true); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR, new RGB(127, 127, 159)); store.setDefault(PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR, new RGB(63, 63, 191)); store.setDefault(PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD, false); PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR, new RGB(63, 95, 191)); store.setDefault(PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD, false); store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION, true); store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 500); store.setDefault(PreferenceConstants.CODEASSIST_AUTOINSERT, true); PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, new RGB(254, 241, 233)); PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, new RGB(0, 0, 0)); PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, new RGB(254, 241, 233)); PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(0, 0, 0)); PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, new RGB(255, 255, 0)); PreferenceConverter.setDefault(store, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, new RGB(255, 0, 0)); store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, "."); //$NON-NLS-1$ store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, "@"); //$NON-NLS-1$ store.setDefault(PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, true); store.setDefault(PreferenceConstants.CODEASSIST_CASE_SENSITIVITY, false); store.setDefault(PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, false); store.setDefault(PreferenceConstants.CODEASSIST_ADDIMPORT, true); store.setDefault(PreferenceConstants.CODEASSIST_INSERT_COMPLETION, true); store.setDefault(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, false); store.setDefault(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, true); store.setDefault(PreferenceConstants.EDITOR_SMART_HOME_END, true); store.setDefault(PreferenceConstants.EDITOR_SMART_PASTE, true); store.setDefault(PreferenceConstants.EDITOR_CLOSE_STRINGS, true); store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACKETS, true); store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACES, true); store.setDefault(PreferenceConstants.EDITOR_CLOSE_JAVADOCS, true); store.setDefault(PreferenceConstants.EDITOR_WRAP_STRINGS, true); store.setDefault(PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, true); store.setDefault(PreferenceConstants.EDITOR_FORMAT_JAVADOCS, true); store.setDefault(PreferenceConstants.EDITOR_DEFAULT_HOVER, JavaPlugin.ID_BESTMATCH_HOVER); store.setDefault(PreferenceConstants.EDITOR_NONE_HOVER, PreferenceConstants.EDITOR_DEFAULT_HOVER_CONFIGURED_ID); store.setDefault(PreferenceConstants.EDITOR_CTRL_HOVER, JavaPlugin.ID_SOURCE_HOVER); store.setDefault(PreferenceConstants.EDITOR_SHIFT_HOVER, PreferenceConstants.EDITOR_DEFAULT_HOVER_CONFIGURED_ID); store.setDefault(PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER, PreferenceConstants.EDITOR_DEFAULT_HOVER_CONFIGURED_ID); store.setDefault(PreferenceConstants.EDITOR_CTRL_ALT_HOVER, PreferenceConstants.EDITOR_DEFAULT_HOVER_CONFIGURED_ID); store.setDefault(PreferenceConstants.EDITOR_ALT_SHIFT_HOVER, PreferenceConstants.EDITOR_DEFAULT_HOVER_CONFIGURED_ID); store.setDefault(PreferenceConstants.EDITOR_CTRL_ALT_SHIFT_HOVER, PreferenceConstants.EDITOR_DEFAULT_HOVER_CONFIGURED_ID); // do more complicated stuff NewJavaProjectPreferencePage.initDefaults(store); } /** * Returns the JDT-UI preference store. * * @return the JDT-UI preference store */ public static IPreferenceStore getPreferenceStore() { return JavaPlugin.getDefault().getPreferenceStore(); } /** * Encodes a JRE library to be used in the named preference <code>NEWPROJECT_JRELIBRARY_LIST</code>. * * @param description a string value describing the JRE library. The description is used * to indentify the JDR library in the UI * @param entries an array of classpath entries to be encoded * * @return the encoded string. */ public static String encodeJRELibrary(String description, IClasspathEntry[] entries) { return NewJavaProjectPreferencePage.encodeJRELibrary(description, entries); } /** * Decodes an encoded JRE library and returns its description string. * * @return the description of an encoded JRE library * * @see #encodeJRELibrary(String, IClasspathEntry[]) */ public static String decodeJRELibraryDescription(String encodedLibrary) { return NewJavaProjectPreferencePage.decodeJRELibraryDescription(encodedLibrary); } /** * Decodes an encoded JRE library and returns its classpath entries. * * @return the array of classpath entries of an encoded JRE library. * * @see #encodeJRELibrary(String, IClasspathEntry[]) */ public static IClasspathEntry[] decodeJRELibraryClasspathEntries(String encodedLibrary) { return NewJavaProjectPreferencePage.decodeJRELibraryClasspathEntries(encodedLibrary); } /** * Returns the current configuration for the JRE to be used as default in new Java projects. * This is a convenience method to access the named preference <code>NEWPROJECT_JRELIBRARY_LIST * </code> with the index defined by <code> NEWPROJECT_JRELIBRARY_INDEX</code>. * * @return the current default set of classpath entries * * @see #NEWPROJECT_JRELIBRARY_LIST * @see #NEWPROJECT_JRELIBRARY_INDEX */ public static IClasspathEntry[] getDefaultJRELibrary() { return NewJavaProjectPreferencePage.getDefaultJRELibrary(); } }
27,415
Bug 27415 inline method is too scared of compile warnings [refactoring]
20021127 package p; public class A { static final int I= 0; void f(){ int iiiii= I; int j= iiiii; //j++; } void fg(){ f(); } } try inlining fg() - cannot because it complains about the warning. uncomment the commented line and it will make inline method happy
resolved fixed
06f8e60
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T12:53:25Z
2002-11-29T17:13:20Z
org.eclipse.jdt.ui/core
27,415
Bug 27415 inline method is too scared of compile warnings [refactoring]
20021127 package p; public class A { static final int I= 0; void f(){ int iiiii= I; int j= iiiii; //j++; } void fg(){ f(); } } try inlining fg() - cannot because it complains about the warning. uncomment the commented line and it will make inline method happy
resolved fixed
06f8e60
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T12:53:25Z
2002-11-29T17:13:20Z
extension/org/eclipse/jdt/internal/corext/dom/ASTNodes.java
27,415
Bug 27415 inline method is too scared of compile warnings [refactoring]
20021127 package p; public class A { static final int I= 0; void f(){ int iiiii= I; int j= iiiii; //j++; } void fg(){ f(); } } try inlining fg() - cannot because it complains about the warning. uncomment the commented line and it will make inline method happy
resolved fixed
06f8e60
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T12:53:25Z
2002-11-29T17:13:20Z
org.eclipse.jdt.ui/core
27,415
Bug 27415 inline method is too scared of compile warnings [refactoring]
20021127 package p; public class A { static final int I= 0; void f(){ int iiiii= I; int j= iiiii; //j++; } void fg(){ f(); } } try inlining fg() - cannot because it complains about the warning. uncomment the commented line and it will make inline method happy
resolved fixed
06f8e60
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T12:53:25Z
2002-11-29T17:13:20Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceAnalyzer.java
27,415
Bug 27415 inline method is too scared of compile warnings [refactoring]
20021127 package p; public class A { static final int I= 0; void f(){ int iiiii= I; int j= iiiii; //j++; } void fg(){ f(); } } try inlining fg() - cannot because it complains about the warning. uncomment the commented line and it will make inline method happy
resolved fixed
06f8e60
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T12:53:25Z
2002-11-29T17:13:20Z
org.eclipse.jdt.ui/core
27,415
Bug 27415 inline method is too scared of compile warnings [refactoring]
20021127 package p; public class A { static final int I= 0; void f(){ int iiiii= I; int j= iiiii; //j++; } void fg(){ f(); } } try inlining fg() - cannot because it complains about the warning. uncomment the commented line and it will make inline method happy
resolved fixed
06f8e60
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T12:53:25Z
2002-11-29T17:13:20Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RefactoringAnalyzeUtil.java
24,931
Bug 24931 inline method - adds unnecessary assignment [refactoring]
I-20021016 linux-gtk: public class Moo { void foo(int a) { System.out.println(a); } void goo() { int n= 42; foo(n); int x= 7; // <-- } } 1. select foo in goo 2. inline method 3. press next 4. observe that the method invocation 'foo(n);' is replaced by 'int a= n; System.out.println(a);' This assignment is unnecessary und will go away if the following unrelated statement ('int x= 7;') is removed. I assume this is some sort of conservative strategy to avoid variable name clashes.
resolved fixed
bbf8cf0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T13:52:59Z
2002-10-17T13:06:40Z
org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_in/TestLocalReferenceUnused.java
package argument_in; public class TestLocalReferenceUnused { public void main() { int i= 10; /*]*/foo(i);/*[*/ } public void foo(int x) { x= x + 10; bar(x); } public void bar(int z) { } }
24,931
Bug 24931 inline method - adds unnecessary assignment [refactoring]
I-20021016 linux-gtk: public class Moo { void foo(int a) { System.out.println(a); } void goo() { int n= 42; foo(n); int x= 7; // <-- } } 1. select foo in goo 2. inline method 3. press next 4. observe that the method invocation 'foo(n);' is replaced by 'int a= n; System.out.println(a);' This assignment is unnecessary und will go away if the following unrelated statement ('int x= 7;') is removed. I assume this is some sort of conservative strategy to avoid variable name clashes.
resolved fixed
bbf8cf0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T13:52:59Z
2002-10-17T13:06:40Z
org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_out/TestLocalReferenceUnused.java
package argument_out; public class TestLocalReferenceUnused { public void main() { int i= 10; /*]*/i= i + 10; bar(i);/*[*/ } public void foo(int x) { x= x + 10; bar(x); } public void bar(int z) { } }
24,931
Bug 24931 inline method - adds unnecessary assignment [refactoring]
I-20021016 linux-gtk: public class Moo { void foo(int a) { System.out.println(a); } void goo() { int n= 42; foo(n); int x= 7; // <-- } } 1. select foo in goo 2. inline method 3. press next 4. observe that the method invocation 'foo(n);' is replaced by 'int a= n; System.out.println(a);' This assignment is unnecessary und will go away if the following unrelated statement ('int x= 7;') is removed. I assume this is some sort of conservative strategy to avoid variable name clashes.
resolved fixed
bbf8cf0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T13:52:59Z
2002-10-17T13:06:40Z
org.eclipse.jdt.ui/core
24,931
Bug 24931 inline method - adds unnecessary assignment [refactoring]
I-20021016 linux-gtk: public class Moo { void foo(int a) { System.out.println(a); } void goo() { int n= 42; foo(n); int x= 7; // <-- } } 1. select foo in goo 2. inline method 3. press next 4. observe that the method invocation 'foo(n);' is replaced by 'int a= n; System.out.println(a);' This assignment is unnecessary und will go away if the following unrelated statement ('int x= 7;') is removed. I assume this is some sort of conservative strategy to avoid variable name clashes.
resolved fixed
bbf8cf0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T13:52:59Z
2002-10-17T13:06:40Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CallInliner.java
24,931
Bug 24931 inline method - adds unnecessary assignment [refactoring]
I-20021016 linux-gtk: public class Moo { void foo(int a) { System.out.println(a); } void goo() { int n= 42; foo(n); int x= 7; // <-- } } 1. select foo in goo 2. inline method 3. press next 4. observe that the method invocation 'foo(n);' is replaced by 'int a= n; System.out.println(a);' This assignment is unnecessary und will go away if the following unrelated statement ('int x= 7;') is removed. I assume this is some sort of conservative strategy to avoid variable name clashes.
resolved fixed
bbf8cf0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T13:52:59Z
2002-10-17T13:06:40Z
org.eclipse.jdt.ui/core
24,931
Bug 24931 inline method - adds unnecessary assignment [refactoring]
I-20021016 linux-gtk: public class Moo { void foo(int a) { System.out.println(a); } void goo() { int n= 42; foo(n); int x= 7; // <-- } } 1. select foo in goo 2. inline method 3. press next 4. observe that the method invocation 'foo(n);' is replaced by 'int a= n; System.out.println(a);' This assignment is unnecessary und will go away if the following unrelated statement ('int x= 7;') is removed. I assume this is some sort of conservative strategy to avoid variable name clashes.
resolved fixed
bbf8cf0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T13:52:59Z
2002-10-17T13:06:40Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceAnalyzer.java
24,931
Bug 24931 inline method - adds unnecessary assignment [refactoring]
I-20021016 linux-gtk: public class Moo { void foo(int a) { System.out.println(a); } void goo() { int n= 42; foo(n); int x= 7; // <-- } } 1. select foo in goo 2. inline method 3. press next 4. observe that the method invocation 'foo(n);' is replaced by 'int a= n; System.out.println(a);' This assignment is unnecessary und will go away if the following unrelated statement ('int x= 7;') is removed. I assume this is some sort of conservative strategy to avoid variable name clashes.
resolved fixed
bbf8cf0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T13:52:59Z
2002-10-17T13:06:40Z
org.eclipse.jdt.ui/core
24,931
Bug 24931 inline method - adds unnecessary assignment [refactoring]
I-20021016 linux-gtk: public class Moo { void foo(int a) { System.out.println(a); } void goo() { int n= 42; foo(n); int x= 7; // <-- } } 1. select foo in goo 2. inline method 3. press next 4. observe that the method invocation 'foo(n);' is replaced by 'int a= n; System.out.println(a);' This assignment is unnecessary und will go away if the following unrelated statement ('int x= 7;') is removed. I assume this is some sort of conservative strategy to avoid variable name clashes.
resolved fixed
bbf8cf0
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T13:52:59Z
2002-10-17T13:06:40Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/flow/FlowInfo.java
26,318
Bug 26318 Inline Method: attempts to inline any constructor -- just deletes constructor[refactoring]
Inline Method seems to attempt to inline any constructor. It appears to never create any changes except for deleting the constructor when the "Delete method declaration" checkbox is selected.
resolved fixed
e0c8f1b
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T14:21:40Z
2002-11-14T16:06:40Z
org.eclipse.jdt.ui/core
26,318
Bug 26318 Inline Method: attempts to inline any constructor -- just deletes constructor[refactoring]
Inline Method seems to attempt to inline any constructor. It appears to never create any changes except for deleting the constructor when the "Delete method declaration" checkbox is selected.
resolved fixed
e0c8f1b
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T14:21:40Z
2002-11-14T16:06:40Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceAnalyzer.java
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
org.eclipse.jdt.ui/core
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/base/RefactoringStatus.java
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
org.eclipse.jdt.ui/core
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/base/RefactoringStatusCodes.java
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
org.eclipse.jdt.ui/core
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineMethodRefactoring.java
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
org.eclipse.jdt.ui/core
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/TargetProvider.java
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
org.eclipse.jdt.ui/core
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
refactoring/org/eclipse/jdt/internal/corext/refactoring/util/TextChangeManager.java
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
org.eclipse.jdt.ui/ui
24,912
Bug 24912 inline method - inline method breaks code when inlining into a field initializer [refactoring]
I-20021016 linux-gtk: public class Doo { private final static int MAGIC= compute(); private final static int compute() { return 42; } } There are two issues: 1) If select the use of compute() is selected for inlining, then I get a message on the preview page that it's not possible to inline inside a field initializer. This is true in general, but in this particular case, it would be possible. 2) If I select the declaration of the method, I don't get any error on the preview page. When I hit finish(), I will end up with a compile error, since the method is simply removed.
resolved fixed
f065299
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2002-12-23T15:56:43Z
2002-10-17T10:20:00Z
refactoring/org/eclipse/jdt/internal/ui/refactoring/code/InlineMethodInputPage.java
26,186
Bug 26186 Java preference page should use group bpxes instead of labels
20021113 The labels on the Radio groups in the JavaPreferencePage will not be read by screen readers. Use Group boxes instead. Also an issue for the Code Generation, New Project and Refactoring Page.
resolved fixed
702a1e6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-01-06T18:12:53Z
2002-11-13T20:40:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/AppearancePreferencePage.java
package org.eclipse.jdt.internal.ui.preferences; import org.eclipse.core.runtime.IStatus; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaUIMessages; import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; import org.eclipse.jdt.internal.ui.dialogs.StatusUtil; 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.LayoutUtil; import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField; import org.eclipse.jdt.internal.ui.wizards.dialogfields.Separator; import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField; public class AppearancePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private static final String SHOW_CU_CHILDREN= PreferenceConstants.SHOW_CU_CHILDREN; private static final String PREF_METHOD_RETURNTYPE= PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE; private static final String PREF_OVERRIDE_INDICATOR= PreferenceConstants.APPEARANCE_OVERRIDE_INDICATOR; private static final String PREF_COMPRESS_PACKAGE_NAMES= PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES; private static final String PREF_PKG_NAME_PATTERN_FOR_PKG_VIEW= PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW; private static final String STACK_BROWSING_VIEWS_VERTICALLY= PreferenceConstants.BROWSING_STACK_VERTICALLY; private static final String PREF_FOLD_PACKAGES_IN_PACKAGE_EXPLORER= PreferenceConstants.APPEARANCE_FOLD_PACKAGES_IN_PACKAGE_EXPLORER; /** * @deprecated Inline to remove reference to preference page */ public static boolean showMethodReturnType() { return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE); } /** * @deprecated Inline to remove reference to preference page */ public static boolean showOverrideIndicators() { return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.APPEARANCE_OVERRIDE_INDICATOR); } /** * @deprecated Inline to remove reference to preference page * / public static boolean arePackagesFoldedInHierarchicalLayout(){ return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.APPEARANCE_FOLD_PACKAGES_IN_PACKAGE_EXPLORER); } /** * @deprecated Inline to remove reference to preference page */ public static String getPkgNamePatternForPackagesView() { IPreferenceStore store= PreferenceConstants.getPreferenceStore(); if (!store.getBoolean(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES)) return ""; //$NON-NLS-1$ return store.getString(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW); } private SelectionButtonDialogField fShowMethodReturnType; private SelectionButtonDialogField fShowOverrideIndicator; private SelectionButtonDialogField fCompressPackageNames; private SelectionButtonDialogField fStackBrowsingViewsVertically; private SelectionButtonDialogField fShowMembersInPackageView; private StringDialogField fPackageNamePattern; private SelectionButtonDialogField fFoldPackagesInPackageExplorer; public AppearancePreferencePage() { setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore()); setDescription(JavaUIMessages.getString("AppearancePreferencePage.description")); //$NON-NLS-1$ IDialogFieldListener listener= new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { doDialogFieldChanged(field); } }; fShowMethodReturnType= new SelectionButtonDialogField(SWT.CHECK); fShowMethodReturnType.setDialogFieldListener(listener); fShowMethodReturnType.setLabelText(JavaUIMessages.getString("AppearancePreferencePage.methodreturntype.label")); //$NON-NLS-1$ fShowOverrideIndicator= new SelectionButtonDialogField(SWT.CHECK); fShowOverrideIndicator.setDialogFieldListener(listener); fShowOverrideIndicator.setLabelText(JavaUIMessages.getString("AppearancePreferencePage.overrideindicator.label")); //$NON-NLS-1$ fShowMembersInPackageView= new SelectionButtonDialogField(SWT.CHECK); fShowMembersInPackageView.setDialogFieldListener(listener); fShowMembersInPackageView.setLabelText(JavaUIMessages.getString("AppearancePreferencePage.showMembersInPackagesView")); //$NON-NLS-1$ fStackBrowsingViewsVertically= new SelectionButtonDialogField(SWT.CHECK); fStackBrowsingViewsVertically.setDialogFieldListener(listener); fStackBrowsingViewsVertically.setLabelText(JavaUIMessages.getString("AppearancePreferencePage.stackViewsVerticallyInTheJavaBrowsingPerspective")); //$NON-NLS-1$ fFoldPackagesInPackageExplorer= new SelectionButtonDialogField(SWT.CHECK); fFoldPackagesInPackageExplorer.setDialogFieldListener(listener); fFoldPackagesInPackageExplorer.setLabelText(JavaUIMessages.getString("AppearancePreferencePage.foldEmptyPackages")); //$NON-NLS-1$ fCompressPackageNames= new SelectionButtonDialogField(SWT.CHECK); fCompressPackageNames.setDialogFieldListener(listener); fCompressPackageNames.setLabelText(JavaUIMessages.getString("AppearancePreferencePage.pkgNamePatternEnable.label")); //$NON-NLS-1$ fPackageNamePattern= new StringDialogField(); fPackageNamePattern.setDialogFieldListener(listener); fPackageNamePattern.setLabelText(JavaUIMessages.getString("AppearancePreferencePage.pkgNamePattern.label")); //$NON-NLS-1$ } private void initFields() { IPreferenceStore prefs= getPreferenceStore(); fShowMethodReturnType.setSelection(prefs.getBoolean(PREF_METHOD_RETURNTYPE)); fShowOverrideIndicator.setSelection(prefs.getBoolean(PREF_OVERRIDE_INDICATOR)); fShowMembersInPackageView.setSelection(prefs.getBoolean(SHOW_CU_CHILDREN)); fStackBrowsingViewsVertically.setSelection(prefs.getBoolean(STACK_BROWSING_VIEWS_VERTICALLY)); fPackageNamePattern.setText(prefs.getString(PREF_PKG_NAME_PATTERN_FOR_PKG_VIEW)); fCompressPackageNames.setSelection(prefs.getBoolean(PREF_COMPRESS_PACKAGE_NAMES)); fPackageNamePattern.setEnabled(fCompressPackageNames.isSelected()); fFoldPackagesInPackageExplorer.setSelection(prefs.getBoolean(PREF_FOLD_PACKAGES_IN_PACKAGE_EXPLORER)); } /* * @see PreferencePage#createControl(Composite) */ public void createControl(Composite parent) { super.createControl(parent); WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.APPEARANCE_PREFERENCE_PAGE); } /* * @see PreferencePage#createContents(Composite) */ protected Control createContents(Composite parent) { initializeDialogUnits(parent); int nColumns= 1; GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= nColumns; Composite composite= new Composite(parent, SWT.NONE); composite.setLayout(layout); fShowMethodReturnType.doFillIntoGrid(composite, nColumns); fShowOverrideIndicator.doFillIntoGrid(composite, nColumns); fShowMembersInPackageView.doFillIntoGrid(composite, nColumns); fFoldPackagesInPackageExplorer.doFillIntoGrid(composite, nColumns); new Separator().doFillIntoGrid(composite, nColumns); fCompressPackageNames.doFillIntoGrid(composite, nColumns); fPackageNamePattern.doFillIntoGrid(composite, 2); LayoutUtil.setHorizontalGrabbing(fPackageNamePattern.getTextControl(null)); LayoutUtil.setWidthHint(fPackageNamePattern.getLabelControl(null), convertWidthInCharsToPixels(65)); new Separator().doFillIntoGrid(composite, nColumns); fStackBrowsingViewsVertically.doFillIntoGrid(composite, nColumns); DialogField field= new DialogField(); field.setLabelText(JavaUIMessages.getString("AppearancePreferencePage.preferenceOnlyEffectiveForNewPerspectives")); //$NON-NLS-1$ field.doFillIntoGrid(composite, 2); initFields(); return composite; } private void doDialogFieldChanged(DialogField field) { if (field == fCompressPackageNames) fPackageNamePattern.setEnabled(fCompressPackageNames.isSelected()); updateStatus(getValidationStatus()); } private IStatus getValidationStatus(){ if (fCompressPackageNames.isSelected() && fPackageNamePattern.getText().equals("")) //$NON-NLS-1$ return new StatusInfo(IStatus.ERROR, JavaUIMessages.getString("AppearancePreferencePage.packageNameCompressionPattern.error.isEmpty")); //$NON-NLS-1$ else return new StatusInfo(); } private void updateStatus(IStatus status) { setValid(!status.matches(IStatus.ERROR)); StatusUtil.applyToStatusLine(this, status); } /* * @see IWorkbenchPreferencePage#init(IWorkbench) */ public void init(IWorkbench workbench) { } /* * @see IPreferencePage#performOk() */ public boolean performOk() { IPreferenceStore prefs= getPreferenceStore(); prefs.setValue(PREF_METHOD_RETURNTYPE, fShowMethodReturnType.isSelected()); prefs.setValue(PREF_OVERRIDE_INDICATOR, fShowOverrideIndicator.isSelected()); prefs.setValue(SHOW_CU_CHILDREN, fShowMembersInPackageView.isSelected()); prefs.setValue(STACK_BROWSING_VIEWS_VERTICALLY, fStackBrowsingViewsVertically.isSelected()); prefs.setValue(PREF_PKG_NAME_PATTERN_FOR_PKG_VIEW, fPackageNamePattern.getText()); prefs.setValue(PREF_COMPRESS_PACKAGE_NAMES, fCompressPackageNames.isSelected()); prefs.setValue(PREF_FOLD_PACKAGES_IN_PACKAGE_EXPLORER, fFoldPackagesInPackageExplorer.isSelected()); JavaPlugin.getDefault().savePluginPreferences(); return super.performOk(); } /* * @see PreferencePage#performDefaults() */ protected void performDefaults() { IPreferenceStore prefs= getPreferenceStore(); fShowMethodReturnType.setSelection(prefs.getDefaultBoolean(PREF_METHOD_RETURNTYPE)); fShowOverrideIndicator.setSelection(prefs.getDefaultBoolean(PREF_OVERRIDE_INDICATOR)); fShowMembersInPackageView.setSelection(prefs.getDefaultBoolean(SHOW_CU_CHILDREN)); fStackBrowsingViewsVertically.setSelection(prefs.getDefaultBoolean(STACK_BROWSING_VIEWS_VERTICALLY)); fPackageNamePattern.setText(prefs.getDefaultString(PREF_PKG_NAME_PATTERN_FOR_PKG_VIEW)); fCompressPackageNames.setSelection(prefs.getDefaultBoolean(PREF_COMPRESS_PACKAGE_NAMES)); fFoldPackagesInPackageExplorer.setSelection(prefs.getDefaultBoolean(PREF_FOLD_PACKAGES_IN_PACKAGE_EXPLORER)); super.performDefaults(); } }
26,186
Bug 26186 Java preference page should use group bpxes instead of labels
20021113 The labels on the Radio groups in the JavaPreferencePage will not be read by screen readers. Use Group boxes instead. Also an issue for the Code Generation, New Project and Refactoring Page.
resolved fixed
702a1e6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-01-06T18:12:53Z
2002-11-13T20:40:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/CodeGenerationPreferencePage.java
package org.eclipse.jdt.internal.ui.preferences; import java.util.StringTokenizer; import org.eclipse.core.runtime.IStatus; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.jdt.core.JavaConventions; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaUIMessages; import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; import org.eclipse.jdt.internal.ui.dialogs.StatusUtil; 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.LayoutUtil; import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField; import org.eclipse.jdt.internal.ui.wizards.dialogfields.Separator; import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField; public class CodeGenerationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private static final String PREF_USE_GETTERSETTER_PREFIX= PreferenceConstants.CODEGEN_USE_GETTERSETTER_PREFIX; private static final String PREF_GETTERSETTER_PREFIX= PreferenceConstants.CODEGEN_GETTERSETTER_PREFIX; private static final String PREF_USE_GETTERSETTER_SUFFIX= PreferenceConstants.CODEGEN_USE_GETTERSETTER_SUFFIX; private static final String PREF_GETTERSETTER_SUFFIX= PreferenceConstants.CODEGEN_GETTERSETTER_SUFFIX; private static final String PREF_JAVADOC_STUBS= PreferenceConstants.CODEGEN__JAVADOC_STUBS; private static final String PREF_NON_JAVADOC_COMMENTS= PreferenceConstants.CODEGEN__NON_JAVADOC_COMMENTS; private static final String PREF_FILE_COMMENTS= PreferenceConstants.CODEGEN__FILE_COMMENTS; /** * @deprecated Inline to avoid reference to preference page */ public static String[] getGetterStetterPrefixes() { IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore(); if (prefs.getBoolean(PREF_USE_GETTERSETTER_PREFIX)) { String str= prefs.getString(PREF_GETTERSETTER_PREFIX); if (str != null) { return unpackOrderList(str); } } return new String[0]; } /** * @deprecated Inline to avoid reference to preference page */ public static String[] getGetterStetterSuffixes() { IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore(); if (prefs.getBoolean(PREF_USE_GETTERSETTER_SUFFIX)) { String str= prefs.getString(PREF_GETTERSETTER_SUFFIX); if (str != null) { return unpackOrderList(str); } } return new String[0]; } /** * @deprecated Inline to avoid reference to preference page */ public static boolean doCreateComments() { IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore(); return prefs.getBoolean(PREF_JAVADOC_STUBS); } /** * @deprecated Inline to avoid reference to preference page */ public static boolean doNonJavaDocSeeComments() { IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore(); return prefs.getBoolean(PREF_NON_JAVADOC_COMMENTS); } /** * @deprecated Inline to avoid reference to preference page */ public static boolean doFileComments() { IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore(); return prefs.getBoolean(PREF_FILE_COMMENTS); } private static String[] unpackOrderList(String str) { StringTokenizer tok= new StringTokenizer(str, ","); //$NON-NLS-1$ int nTokens= tok.countTokens(); String[] res= new String[nTokens]; for (int i= 0; i < nTokens; i++) { res[i]= tok.nextToken().trim(); } return res; } private SelectionButtonDialogField fUseGetterSetterPrefix; private SelectionButtonDialogField fUseGetterSetterSuffix; private StringDialogField fGetterSetterPrefix; private StringDialogField fGetterSetterSuffix; private SelectionButtonDialogField fCreateJavaDocComments; private SelectionButtonDialogField fCreateNonJavadocComments; private SelectionButtonDialogField fCreateFileComments; private IStatus fGetterSetterPrefixStatus; private IStatus fGetterSetterSuffixStatus; public CodeGenerationPreferencePage() { setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore()); setDescription(JavaUIMessages.getString("CodeGenerationPreferencePage.description")); //$NON-NLS-1$ IDialogFieldListener listener= new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { doDialogFieldChanged(field); } }; fGetterSetterPrefixStatus= new StatusInfo(); fGetterSetterSuffixStatus= new StatusInfo(); fUseGetterSetterPrefix= new SelectionButtonDialogField(SWT.CHECK); fUseGetterSetterPrefix.setDialogFieldListener(listener); fUseGetterSetterPrefix.setLabelText(JavaUIMessages.getString("CodeGenerationPreferencePage.gettersetter.prefix.checkbox")); //$NON-NLS-1$ fGetterSetterPrefix= new StringDialogField(); fGetterSetterPrefix.setDialogFieldListener(listener); fGetterSetterPrefix.setLabelText(JavaUIMessages.getString("CodeGenerationPreferencePage.gettersetter.prefix.list")); //$NON-NLS-1$ fUseGetterSetterSuffix= new SelectionButtonDialogField(SWT.CHECK); fUseGetterSetterSuffix.setDialogFieldListener(listener); fUseGetterSetterSuffix.setLabelText(JavaUIMessages.getString("CodeGenerationPreferencePage.gettersetter.suffix.checkbox")); //$NON-NLS-1$ fGetterSetterSuffix= new StringDialogField(); fGetterSetterSuffix.setDialogFieldListener(listener); fGetterSetterSuffix.setLabelText(JavaUIMessages.getString("CodeGenerationPreferencePage.gettersetter.suffix.list")); //$NON-NLS-1$ fCreateJavaDocComments= new SelectionButtonDialogField(SWT.CHECK); fCreateJavaDocComments.setLabelText(JavaUIMessages.getString("CodeGenerationPreferencePage.javadoc_comment.label")); //$NON-NLS-1$ fCreateNonJavadocComments= new SelectionButtonDialogField(SWT.CHECK); fCreateNonJavadocComments.setLabelText(JavaUIMessages.getString("CodeGenerationPreferencePage.see_comment.label")); //$NON-NLS-1$ fCreateFileComments= new SelectionButtonDialogField(SWT.CHECK); fCreateFileComments.setLabelText(JavaUIMessages.getString("CodeGenerationPreferencePage.file_comment.label")); //$NON-NLS-1$ } private void initFields() { IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore(); fUseGetterSetterSuffix.setSelection(prefs.getBoolean(PREF_USE_GETTERSETTER_SUFFIX)); String str= prefs.getString(PREF_GETTERSETTER_SUFFIX); if (str == null) { str= ""; //$NON-NLS-1$ } fGetterSetterSuffix.setText(str); fUseGetterSetterPrefix.setSelection(prefs.getBoolean(PREF_USE_GETTERSETTER_PREFIX)); str= prefs.getString(PREF_GETTERSETTER_PREFIX); if (str == null) { str= ""; //$NON-NLS-1$ } fGetterSetterPrefix.setText(str); fCreateJavaDocComments.setSelection(prefs.getBoolean(PREF_JAVADOC_STUBS)); fCreateNonJavadocComments.setSelection(prefs.getBoolean(PREF_NON_JAVADOC_COMMENTS)); fCreateFileComments.setSelection(prefs.getBoolean(PREF_FILE_COMMENTS)); } /* * @see PreferencePage#createControl(Composite) */ public void createControl(Composite parent) { super.createControl(parent); WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.CODE_MANIPULATION_PREFERENCE_PAGE); } /* * @see PreferencePage#createContents(Composite) */ protected Control createContents(Composite parent) { GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 2; Composite composite= new Composite(parent, SWT.NONE); composite.setLayout(layout); int horizontalIndent= convertWidthInCharsToPixels(4); (new Separator()).doFillIntoGrid(composite, 2, 4); DialogField javaDocLabel= new DialogField(); javaDocLabel.setLabelText(JavaUIMessages.getString("CodeGenerationPreferencePage.comments.label")); //$NON-NLS-1$ javaDocLabel.doFillIntoGrid(composite, 2); fCreateJavaDocComments.doFillIntoGrid(composite, 2); fCreateNonJavadocComments.doFillIntoGrid(composite, 2); fCreateFileComments.doFillIntoGrid(composite, 2); (new Separator()).doFillIntoGrid(composite, 2, 4); DialogField getterSetterLabel= new DialogField(); getterSetterLabel.setLabelText(JavaUIMessages.getString("CodeGenerationPreferencePage.gettersetter.label")); //$NON-NLS-1$ getterSetterLabel.doFillIntoGrid(composite, 2); fUseGetterSetterPrefix.doFillIntoGrid(composite, 2); fGetterSetterPrefix.doFillIntoGrid(composite, 2); LayoutUtil.setHorizontalIndent(fGetterSetterPrefix.getLabelControl(null), horizontalIndent); LayoutUtil.setHorizontalGrabbing(fGetterSetterPrefix.getTextControl(null)); fUseGetterSetterSuffix.doFillIntoGrid(composite, 2); fGetterSetterSuffix.doFillIntoGrid(composite, 2); LayoutUtil.setHorizontalIndent(fGetterSetterSuffix.getLabelControl(null), horizontalIndent); initFields(); return composite; } private void doDialogFieldChanged(DialogField field) { if (field == fGetterSetterPrefix || field == fUseGetterSetterPrefix) { fGetterSetterPrefix.setEnabled(fUseGetterSetterPrefix.isSelected()); if (fUseGetterSetterPrefix.isSelected()) { String[] prefixes= unpackOrderList(fGetterSetterPrefix.getText()); fGetterSetterPrefixStatus= validateIdentifiers(prefixes, true); } else { fGetterSetterPrefixStatus= new StatusInfo(); } } if (field == fGetterSetterSuffix || field == fUseGetterSetterSuffix) { fGetterSetterSuffix.setEnabled(fUseGetterSetterSuffix.isSelected()); if (fUseGetterSetterSuffix.isSelected()) { String[] prefixes= unpackOrderList(fGetterSetterSuffix.getText()); fGetterSetterSuffixStatus= validateIdentifiers(prefixes, false); } else { fGetterSetterSuffixStatus= new StatusInfo(); } } updateStatus(StatusUtil.getMoreSevere(fGetterSetterPrefixStatus, fGetterSetterSuffixStatus)); } private void updateStatus(IStatus status) { setValid(!status.matches(IStatus.ERROR)); StatusUtil.applyToStatusLine(this, status); } private IStatus validateIdentifiers(String[] values, boolean prefix) { for (int i= 0; i < values.length; i++) { String val= values[i]; if (val.length() == 0) { if (prefix) { return new StatusInfo(IStatus.ERROR, JavaUIMessages.getString("CodeGenerationPreferencePage.gettersetter.error.emptyprefix")); //$NON-NLS-1$ } else { return new StatusInfo(IStatus.ERROR, JavaUIMessages.getString("CodeGenerationPreferencePage.gettersetter.error.emptysuffix")); //$NON-NLS-1$ } } String name= prefix ? val + "x" : "x" + val; //$NON-NLS-2$ //$NON-NLS-1$ IStatus status= JavaConventions.validateFieldName(name); if (status.matches(IStatus.ERROR)) { if (prefix) { return new StatusInfo(IStatus.ERROR, JavaUIMessages.getFormattedString("CodeGenerationPreferencePage.gettersetter.error.invalidprefix", val)); //$NON-NLS-1$ } else { return new StatusInfo(IStatus.ERROR, JavaUIMessages.getFormattedString("CodeGenerationPreferencePage.gettersetter.error.invalidsuffix", val)); //$NON-NLS-1$ } } } return new StatusInfo(); } /* * @see IWorkbenchPreferencePage#init(IWorkbench) */ public void init(IWorkbench workbench) { } /* * @see IPreferencePage#performOk() */ public boolean performOk() { IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore(); prefs.setValue(PREF_USE_GETTERSETTER_SUFFIX, fUseGetterSetterSuffix.isSelected()); prefs.setValue(PREF_GETTERSETTER_SUFFIX, fGetterSetterSuffix.getText()); prefs.setValue(PREF_USE_GETTERSETTER_PREFIX, fUseGetterSetterPrefix.isSelected()); prefs.setValue(PREF_GETTERSETTER_PREFIX, fGetterSetterPrefix.getText()); prefs.setValue(PREF_JAVADOC_STUBS, fCreateJavaDocComments.isSelected()); prefs.setValue(PREF_NON_JAVADOC_COMMENTS, fCreateNonJavadocComments.isSelected()); prefs.setValue(PREF_FILE_COMMENTS, fCreateFileComments.isSelected()); JavaPlugin.getDefault().savePluginPreferences(); return super.performOk(); } /* * @see PreferencePage#performDefaults() */ protected void performDefaults() { IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore(); fUseGetterSetterSuffix.setSelection(prefs.getDefaultBoolean(PREF_USE_GETTERSETTER_SUFFIX)); String str= prefs.getDefaultString(PREF_GETTERSETTER_SUFFIX); if (str == null) { str= ""; //$NON-NLS-1$ } fGetterSetterSuffix.setText(str); fUseGetterSetterPrefix.setSelection(prefs.getDefaultBoolean(PREF_USE_GETTERSETTER_PREFIX)); str= prefs.getDefaultString(PREF_GETTERSETTER_PREFIX); if (str == null) { str= ""; //$NON-NLS-1$ } fGetterSetterPrefix.setText(str); fCreateJavaDocComments.setSelection(prefs.getDefaultBoolean(PREF_JAVADOC_STUBS)); fCreateNonJavadocComments.setSelection(prefs.getDefaultBoolean(PREF_NON_JAVADOC_COMMENTS)); fCreateFileComments.setSelection(prefs.getDefaultBoolean(PREF_FILE_COMMENTS)); super.performDefaults(); } }
26,186
Bug 26186 Java preference page should use group bpxes instead of labels
20021113 The labels on the Radio groups in the JavaPreferencePage will not be read by screen readers. Use Group boxes instead. Also an issue for the Code Generation, New Project and Refactoring Page.
resolved fixed
702a1e6
JDT
https://github.com/eclipse-jdt/eclipse.jdt.ui
eclipse-jdt/eclipse.jdt.ui
java
null
null
null
2003-01-06T18:12:53Z
2002-11-13T20:40:00Z
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/JavaBasePreferencePage.java
/* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ // AW package org.eclipse.jdt.internal.ui.preferences; import java.util.ArrayList; import org.eclipse.core.runtime.IStatus; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; 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.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Widget; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaUIMessages; import org.eclipse.jdt.internal.ui.dialogs.StatusUtil; /* * The page for setting general java plugin preferences. * See PreferenceConstants to access or change these values through public API. */ public class JavaBasePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private static final String LINK_PACKAGES_TO_EDITOR= PreferenceConstants.LINK_PACKAGES_TO_EDITOR; private static final String LINK_TYPEHIERARCHY_TO_EDITOR= PreferenceConstants.LINK_TYPEHIERARCHY_TO_EDITOR; private static final String OPEN_TYPE_HIERARCHY= PreferenceConstants.OPEN_TYPE_HIERARCHY; private static final String OPEN_TYPE_HIERARCHY_IN_PERSPECTIVE= PreferenceConstants.OPEN_TYPE_HIERARCHY_IN_PERSPECTIVE; private static final String OPEN_TYPE_HIERARCHY_IN_VIEW_PART= PreferenceConstants.OPEN_TYPE_HIERARCHY_IN_VIEW_PART; private static final String LINK_BROWSING_VIEW_TO_EDITOR= PreferenceConstants.LINK_BROWSING_VIEW_TO_EDITOR; private static final String DOUBLE_CLICK= PreferenceConstants.DOUBLE_CLICK; private static final String DOUBLE_CLICK_GOES_INTO= PreferenceConstants.DOUBLE_CLICK_GOES_INTO; private static final String DOUBLE_CLICK_EXPANDS= PreferenceConstants.DOUBLE_CLICK_EXPANDS; private static final String UPDATE_JAVA_VIEWS= PreferenceConstants.UPDATE_JAVA_VIEWS; private static final String UPDATE_ON_SAVE= PreferenceConstants.UPDATE_ON_SAVE; private static final String UPDATE_WHILE_EDITING= PreferenceConstants.UPDATE_WHILE_EDITING; /** * @deprecated Inline to avoid reference to preference page */ public static boolean openTypeHierarchyInPerspective() { return PreferenceConstants.OPEN_TYPE_HIERARCHY_IN_PERSPECTIVE.equals( PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.OPEN_TYPE_HIERARCHY)); } /** * @deprecated Inline to avoid reference to preference page */ public static boolean openTypeHierarchInViewPart() { return PreferenceConstants.OPEN_TYPE_HIERARCHY_IN_VIEW_PART.equals( PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.OPEN_TYPE_HIERARCHY)); } /** * @deprecated Inline to avoid reference to preference page */ public static boolean reusePerspectiveForTypeHierarchy() { return false; //return PreferenceConstants.getPreferenceStore().getBoolean(OPEN_TYPE_HIERARCHY_REUSE_PERSPECTIVE); } private ArrayList fCheckBoxes; private ArrayList fRadioButtons; private ArrayList fTextControls; private SelectionListener fSelectionListener; private ModifyListener fModifyListener; public JavaBasePreferencePage() { super(); setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore()); setDescription(JavaUIMessages.getString("JavaBasePreferencePage.description")); //$NON-NLS-1$ fRadioButtons= new ArrayList(); fCheckBoxes= new ArrayList(); fTextControls= new ArrayList(); fSelectionListener= new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {} public void widgetSelected(SelectionEvent e) { controlChanged(e.widget); } }; fModifyListener= new ModifyListener() { public void modifyText(ModifyEvent e) { controlModified(e.widget); } }; } /* * @see IWorkbenchPreferencePage#init(IWorkbench) */ public void init(IWorkbench workbench) { } /* * @see PreferencePage#createControl(Composite) */ public void createControl(Composite parent) { super.createControl(parent); WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_BASE_PREFERENCE_PAGE); } private Button addCheckBox(Composite parent, String label, String key) { GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); Button checkBox= new Button(parent, SWT.CHECK); checkBox.setText(label); checkBox.setData(key); checkBox.setLayoutData(gd); checkBox.setSelection(getPreferenceStore().getBoolean(key)); fCheckBoxes.add(checkBox); return checkBox; } private Button addRadioButton(Composite parent, String label, String key, String value) { GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); Button button= new Button(parent, SWT.RADIO); button.setText(label); button.setData(new String[] { key, value }); button.setLayoutData(gd); button.setSelection(value.equals(getPreferenceStore().getString(key))); fRadioButtons.add(button); return button; } private Text addTextControl(Composite parent, String label, String key) { GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); Label labelControl= new Label(parent, SWT.NONE); labelControl.setText(label); labelControl.setLayoutData(gd); gd= new GridData(); gd.widthHint= convertWidthInCharsToPixels(40); Text text= new Text(parent, SWT.SINGLE | SWT.BORDER); text.setText(getPreferenceStore().getString(key)); text.setData(key); text.setLayoutData(gd); fTextControls.add(text); return text; } protected Control createContents(Composite parent) { initializeDialogUnits(parent); Composite composite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; composite.setLayout(layout); new Label(composite, SWT.NONE); // spacer new Label(composite, SWT.NONE).setText(JavaUIMessages.getString("JavaBasePreferencePage.linkSettings.text")); //$NON-NLS-1$ addCheckBox(composite, JavaUIMessages.getString("JavaBasePreferencePage.linkJavaBrowsingViewsCheckbox.text"), LINK_BROWSING_VIEW_TO_EDITOR); //$NON-NLS-1$ addCheckBox(composite, JavaUIMessages.getString("JavaBasePreferencePage.linkPackageView"), LINK_PACKAGES_TO_EDITOR); //$NON-NLS-1$ addCheckBox(composite, JavaUIMessages.getString("JavaBasePreferencePage.linkTypeHierarchy"), LINK_TYPEHIERARCHY_TO_EDITOR); //$NON-NLS-1$ new Label(composite, SWT.NONE); // spacer Label doubleClickLabel1= new Label(composite, SWT.NONE); doubleClickLabel1.setText(JavaUIMessages.getString("JavaBasePreferencePage.updateJavaViews")); //$NON-NLS-1$ Composite doubleClickRadioGroup1= new Composite(composite, SWT.NONE); layout= new GridLayout(); layout.marginHeight= 0; doubleClickRadioGroup1.setLayout(layout); addRadioButton(doubleClickRadioGroup1, JavaUIMessages.getString("JavaBasePreferencePage.onSave"), UPDATE_JAVA_VIEWS, UPDATE_ON_SAVE); //$NON-NLS-1$ addRadioButton(doubleClickRadioGroup1, JavaUIMessages.getString("JavaBasePreferencePage.whileEditing"), UPDATE_JAVA_VIEWS, UPDATE_WHILE_EDITING); //$NON-NLS-1$ Label notice= new Label(composite, SWT.WRAP); notice.setText(JavaUIMessages.getString("JavaBasePreferencePage.notice.outliner")); //$NON-NLS-1$ GridData noticeData= new GridData(GridData.FILL_HORIZONTAL); noticeData.grabExcessHorizontalSpace= true; noticeData.widthHint= convertWidthInCharsToPixels(60); notice.setLayoutData(noticeData); new Label(composite, SWT.NONE); // spacer Label doubleClickLabel= new Label(composite, SWT.NONE); doubleClickLabel.setText(JavaUIMessages.getString("JavaBasePreferencePage.doubleclick.action")); //$NON-NLS-1$ Composite doubleClickRadioGroup= new Composite(composite, SWT.NONE); layout= new GridLayout(); layout.marginHeight= 0; doubleClickRadioGroup.setLayout(layout); addRadioButton(doubleClickRadioGroup, JavaUIMessages.getString("JavaBasePreferencePage.doubleclick.gointo"), DOUBLE_CLICK, DOUBLE_CLICK_GOES_INTO); //$NON-NLS-1$ addRadioButton(doubleClickRadioGroup, JavaUIMessages.getString("JavaBasePreferencePage.doubleclick.expand"), DOUBLE_CLICK, DOUBLE_CLICK_EXPANDS); //$NON-NLS-1$ new Label(composite, SWT.NONE); // spacer Label label= new Label(composite, SWT.NONE); label.setText(JavaUIMessages.getString("JavaBasePreferencePage.openTypeHierarchy")); //$NON-NLS-1$ Composite radioGroup= new Composite(composite, SWT.NONE); layout= new GridLayout(); layout.marginHeight= 0; radioGroup.setLayout(layout); addRadioButton(radioGroup, JavaUIMessages.getString("JavaBasePreferencePage.inPerspective"), OPEN_TYPE_HIERARCHY, OPEN_TYPE_HIERARCHY_IN_PERSPECTIVE); //$NON-NLS-1$ addRadioButton(radioGroup, JavaUIMessages.getString("JavaBasePreferencePage.inView"), OPEN_TYPE_HIERARCHY, OPEN_TYPE_HIERARCHY_IN_VIEW_PART); //$NON-NLS-1$ /* Need support from workbench for this. See http://dev.eclipse.org/bugs/show_bug.cgi?id=3962 final Button reuse= addCheckBox(composite, "&Reuse Type Hierarchy perspective in same window", OPEN_TYPE_HIERARCHY_REUSE_PERSPECTIVE); reuse.setEnabled(perspective.getSelection()); perspective.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { reuse.setEnabled(perspective.getSelection()); } }); */ return composite; } private void updateStatus(IStatus status) { setValid(!status.matches(IStatus.ERROR)); StatusUtil.applyToStatusLine(this, status); } private void controlChanged(Widget widget) { } private void controlModified(Widget widget) { } /* * @see PreferencePage#performDefaults() */ protected void performDefaults() { IPreferenceStore store= getPreferenceStore(); for (int i= 0; i < fCheckBoxes.size(); i++) { Button button= (Button) fCheckBoxes.get(i); String key= (String) button.getData(); button.setSelection(store.getDefaultBoolean(key)); } for (int i= 0; i < fRadioButtons.size(); i++) { Button button= (Button) fRadioButtons.get(i); String[] info= (String[]) button.getData(); button.setSelection(info[1].equals(store.getDefaultString(info[0]))); } for (int i= 0; i < fTextControls.size(); i++) { Text text= (Text) fTextControls.get(i); String key= (String) text.getData(); text.setText(store.getDefaultString(key)); } super.performDefaults(); } /* * @see IPreferencePage#performOk() */ public boolean performOk() { IPreferenceStore store= getPreferenceStore(); for (int i= 0; i < fCheckBoxes.size(); i++) { Button button= (Button) fCheckBoxes.get(i); String key= (String) button.getData(); store.setValue(key, button.getSelection()); } for (int i= 0; i < fRadioButtons.size(); i++) { Button button= (Button) fRadioButtons.get(i); if (button.getSelection()) { String[] info= (String[]) button.getData(); store.setValue(info[0], info[1]); } } for (int i= 0; i < fTextControls.size(); i++) { Text text= (Text) fTextControls.get(i); String key= (String) text.getData(); store.setValue(key, text.getText()); } JavaPlugin.getDefault().savePluginPreferences(); return super.performOk(); } }