issue_id
int64 2.04k
425k
| title
stringlengths 9
251
| body
stringlengths 4
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
unknown | report_datetime
unknown | updated_file
stringlengths 23
187
| chunk_content
stringlengths 1
22k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | try {
String posStr= memento.getString(TAG_HORIZONTAL_POSITION);
int position;
position= new Integer(posStr).intValue();
bar.setSelection(position);
} catch (NumberFormatException e) {
}
}
}
protected void restoreSelectionState(IMemento memento) {
IMemento childMem;
childMem= memento.getChild(TAG_SELECTION);
if (childMem != null) {
ArrayList list= new ArrayList();
IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT);
for (int i= 0; i < elementMem.length; i++) {
Object element= JavaCore.create(elementMem[i].getString(TAG_PATH));
list.add(element);
}
fViewer.setSelection(new StructuredSelection(list));
}
}
protected void restoreExpansionState(IMemento memento) {
IMemento childMem= memento.getChild(TAG_EXPANDED);
if (childMem != null) {
ArrayList elements= new ArrayList();
IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT);
for (int i= 0; i < elementMem.length; i++) {
Object element= JavaCore.create(elementMem[i].getString(TAG_PATH)); |
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | elements.add(element);
}
fViewer.setExpandedElements(elements.toArray());
}
}
/**
* Create the KeyListener for doing the refresh on the viewer.
*/
private void initKeyListener() {
fViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent event) {
doKeyPressed(event.keyCode);
}
});
}
private void doKeyPressed(int key) {
if (key == SWT.F5) {
fRefreshAction.selectionChanged(
(IStructuredSelection) fViewer.getSelection());
if (fRefreshAction.isEnabled())
fRefreshAction.run();
} else if (key == SWT.F4) {
OpenTypeHierarchyUtil.open(getSelection(), getSite().getWorkbenchWindow());
} else if (key == SWT.F3) {
fOpenCUAction.update();
if (fOpenCUAction.isEnabled())
fOpenCUAction.run();
}
} |
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | void initFrameList() {
fFrameSource= new PackagesFrameSource(this);
fFrameList= new FrameList(fFrameSource);
fFrameSource.connectTo(fFrameList);
}
/**
* An editor has been activated. Set the selection in this Packages Viewer
* to be the editor's input, if linking is enabled.
*/
void editorActivated(IEditorPart editor) {
if (!isLinkingEnabled())
return;
Object input= getElementOfInput(editor.getEditorInput());
Object element= null;
if (input instanceof IFile)
element= JavaCore.create((IFile)input);
if (element == null)
element= input;
if (element != null) {
IStructuredSelection oldSelection= (IStructuredSelection)getSelection();
if (oldSelection.size() == 1) {
Object o= oldSelection.getFirstElement();
if (o instanceof IMember) {
IMember m= (IMember)o; |
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | if (element.equals(m.getCompilationUnit()))
return;
if (element.equals(m.getClassFile()))
return;
}
}
ISelection newSelection= new StructuredSelection(element);
if (!fViewer.getSelection().equals(newSelection)) {
try {
fViewer.removeSelectionChangedListener(fSelectionListener);
fViewer.setSelection(newSelection);
} finally {
fViewer.addSelectionChangedListener(fSelectionListener);
}
}
}
}
/**
* A compilation unit or class was expanded, expand
* the main type.
*/
void expandMainType(Object element) {
try {
IType type= null;
if (element instanceof ICompilationUnit) {
ICompilationUnit cu= (ICompilationUnit)element;
IType[] types= cu.getTypes();
if (types.length > 0)
type= types[0]; |
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | }
else if (element instanceof IClassFile) {
IClassFile cf= (IClassFile)element;
type= cf.getType();
}
if (type != null) {
final IType type2= type;
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
ctrl.getDisplay().asyncExec(new Runnable() {
public void run() {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed())
fViewer.expandToLevel(type2, 1);
}
});
}
}
} catch(JavaModelException e) {
}
}
/**
* Returns the element contained in the EditorInput
*/
Object getElementOfInput(IEditorInput input) {
if (input instanceof IClassFileEditorInput)
return ((IClassFileEditorInput)input).getClassFile();
else if (input instanceof IFileEditorInput) |
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | return ((IFileEditorInput)input).getFile();
else if (input instanceof JarEntryEditorInput)
return ((JarEntryEditorInput)input).getStorage();
return null;
}
/**
* Returns the Viewer.
*/
TreeViewer getViewer() {
return fViewer;
}
/**
* Returns the pattern filter for this view.
* @return the pattern filter
*/
JavaElementPatternFilter getPatternFilter() {
return fPatternFilter;
}
/**
* Returns the library filter for this view.
* @return the library filter
*/
LibraryFilter getLibraryFilter() {
return fLibraryFilter;
}
/**
* Returns the working set filter for this view. |
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | * @return the working set filter
*/
WorkingSetFilter getWorkingSetFilter() {
return fWorkingSetFilter;
}
/**
* Returns the Binary filter for this view.
* @return the binary filter
*/
BinaryProjectFilter getBinaryFilter() {
return fBinaryFilter;
}
void restoreFilters() {
IMemento filtersMem= fMemento.getChild(TAG_FILTERS);
if(filtersMem != null) {
IMemento children[]= filtersMem.getChildren(TAG_FILTER);
String filters[]= new String[children.length];
for (int i = 0; i < children.length; i++) {
filters[i]= children[i].getString(TAG_ELEMENT);
}
getPatternFilter().setPatterns(filters);
} else {
getPatternFilter().setPatterns(new String[0]);
}
String show= fMemento.getString(TAG_SHOWLIBRARIES);
if (show != null)
getLibraryFilter().setShowLibraries(show.equals("true"));
else
initLibraryFilterFromPreferences(); |
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | String showbin= fMemento.getString(TAG_SHOWBINARIES);
if (showbin != null)
getBinaryFilter().setShowBinaries(showbin.equals("true"));
else
initBinaryFilterFromPreferences();
String workingSetName= fMemento.getString(TAG_WORKINGSET);
if (workingSetName != null) {
IWorkingSet ws= SearchUI.findWorkingSet(workingSetName);
if (ws != null) {
getWorkingSetFilter().setWorkingSet(ws);
}
}
}
void initFilterFromPreferences() {
initBinaryFilterFromPreferences();
initLibraryFilterFromPreferences();
}
void initLibraryFilterFromPreferences() {
JavaPlugin plugin= JavaPlugin.getDefault();
boolean show= plugin.getPreferenceStore().getBoolean(TAG_SHOWLIBRARIES);
getLibraryFilter().setShowLibraries(show);
}
void initBinaryFilterFromPreferences() {
JavaPlugin plugin= JavaPlugin.getDefault();
boolean showbin= plugin.getPreferenceStore().getBoolean(TAG_SHOWBINARIES); |
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | getBinaryFilter().setShowBinaries(showbin);
}
/**
* Updates the title text and title tool tip.
* Called whenever the input of the viewer changes.
*/
void updateTitle() {
Object input= getViewer().getInput();
String viewName= getConfigurationElement().getAttribute("name");
if (input == null
|| (input instanceof IJavaModel)) {
setTitle(viewName);
setTitleToolTip("");
} else {
ILabelProvider labelProvider = (ILabelProvider) getViewer().getLabelProvider();
String inputText= labelProvider.getText(input);
String title= PackagesMessages.getFormattedString("PackageExplorer.argTitle", new String[] { viewName, inputText });
setTitle(title);
setTitleToolTip(getToolTipText(input));
}
}
/**
* Sets the decorator for the package explorer.
*
* @param decorator a label decorator or <code>null</code> for no decorations.
*/
public void setLabelDecorator(ILabelDecorator decorator) {
JavaElementLabelProvider javaProvider= new JavaElementLabelProvider(getLabelProviderFlags());
javaProvider.setErrorTickManager(new MarkerErrorTickProvider()); |
5,774 | Bug 5774 Unpredicatable behaviour on double click in packages view | from EC: If you double click a file in the packages view, it opens the file (technically, compilation unit I believe) -- if not already open. However, if the file is already open, a single click selects it as the active editor tag; a double click expands its structure in the packages view. This is unpredictable behavior ; | resolved fixed | d13ebe7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T14:10:11Z" | "2001-11-11T14:46:40Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | if (decorator == null) {
fViewer.setLabelProvider(javaProvider);
} else {
fViewer.setLabelProvider(new DecoratingLabelProvider(javaProvider, decorator));
}
}
/**
* Gets the standard label flags
*/
private int getLabelProviderFlags() {
return JavaElementLabelProvider.SHOW_BASICS | JavaElementLabelProvider.SHOW_OVERLAY_ICONS |
JavaElementLabelProvider.SHOW_SMALL_ICONS | JavaElementLabelProvider.SHOW_VARIABLE | JavaElementLabelProvider.SHOW_PARAMETERS;
}
/*
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty() != IPreferencesConstants.SHOW_CU_CHILDREN)
return;
if (fViewer != null) {
IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
boolean b= store.getBoolean(IPreferencesConstants.SHOW_CU_CHILDREN);
((JavaElementContentProvider)fViewer.getContentProvider()).setProvideMembers(b);
fViewer.refresh();
}
}
} |
4,089 | Bug 4089 Editor tooltip for class files should show full path (1GI74EF) | When you hover over the editor tab for a .class file, it just shows you the simple file name. It should show the full path, as for other editors. NOTES: | verified fixed | c33aca1 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T16:40:02Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/InternalClassFileEditorInput.java | package org.eclipse.jdt.internal.ui.javaeditor;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
/**
* Class file considered as editor input.
*/
public class InternalClassFileEditorInput implements IClassFileEditorInput, IPersistableElement { |
4,089 | Bug 4089 Editor tooltip for class files should show full path (1GI74EF) | When you hover over the editor tab for a .class file, it just shows you the simple file name. It should show the full path, as for other editors. NOTES: | verified fixed | c33aca1 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T16:40:02Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/InternalClassFileEditorInput.java | private IClassFile fClassFile;
public InternalClassFileEditorInput(IClassFile classFile) {
fClassFile= classFile;
}
/*
* @see Object#equals(Object)
*/
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof InternalClassFileEditorInput))
return false;
InternalClassFileEditorInput other= (InternalClassFileEditorInput) obj;
return fClassFile.equals(other.fClassFile);
}
/*
* @see Object#hashCode
*/
public int hashCode() { |
4,089 | Bug 4089 Editor tooltip for class files should show full path (1GI74EF) | When you hover over the editor tab for a .class file, it just shows you the simple file name. It should show the full path, as for other editors. NOTES: | verified fixed | c33aca1 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T16:40:02Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/InternalClassFileEditorInput.java | return fClassFile.hashCode();
}
/*
* @see IClassFileEditorInput#getClassFile()
*/
public IClassFile getClassFile() {
return fClassFile;
}
/*
* @see IEditorInput#getPersistable()
*/
public IPersistableElement getPersistable() {
return this;
}
/*
* @see IEditorInput#getName()
*/
public String getName() {
return fClassFile.getElementName();
}
/*
* @see IEditorInput#getFullPath()
*/
public String getFullPath() {
return fClassFile.getElementName();
} |
4,089 | Bug 4089 Editor tooltip for class files should show full path (1GI74EF) | When you hover over the editor tab for a .class file, it just shows you the simple file name. It should show the full path, as for other editors. NOTES: | verified fixed | c33aca1 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T16:40:02Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/InternalClassFileEditorInput.java | /*
* @see IEditorInput#getContentType()
*/
public String getContentType() {
return "class";
}
/*
* @see IEditorInput#getToolTipText()
*/
public String getToolTipText() {
return fClassFile.getElementName();
}
/*
* @see IEditorInput#getImageDescriptor()
*/
public ImageDescriptor getImageDescriptor() {
try {
if (fClassFile.isClass())
return JavaPluginImages.DESC_OBJS_CFILECLASS;
return JavaPluginImages.DESC_OBJS_CFILEINT;
} catch (JavaModelException e) {
}
return JavaPluginImages.DESC_OBJS_CFILE;
}
/* |
4,089 | Bug 4089 Editor tooltip for class files should show full path (1GI74EF) | When you hover over the editor tab for a .class file, it just shows you the simple file name. It should show the full path, as for other editors. NOTES: | verified fixed | c33aca1 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-11T16:40:02Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/InternalClassFileEditorInput.java | * @see IEditorInput#exists()
*/
public boolean exists() {
return fClassFile.exists();
}
/*
* @see IAdaptable#getAdapter(Class)
*/
public Object getAdapter(Class adapter) {
if (adapter == IClassFile.class)
return fClassFile;
return fClassFile.getAdapter(adapter);
}
/*
* @see IPersistableElement#saveState(IMemento)
*/
public void saveState(IMemento memento) {
ClassFileEditorInputFactory.saveState(memento, this);
}
/*
* @see IPersistableElement#getFactoryId()
*/
public String getFactoryId() {
return ClassFileEditorInputFactory.ID;
}
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtTreeViewerDropAdapter.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.dnd;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.jface.viewers.AbstractTreeViewer;
public class JdtTreeViewerDropAdapter extends JdtViewerDropAdapter {
/**
* The time the mouse first started hovering over the current target
*/
protected long hoverStart= 0;
/**
* The amount of time to hover over a tree item before expanding it
*/ |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtTreeViewerDropAdapter.java | private static final long HOVER_THRESHOLD= 1500;
public JdtTreeViewerDropAdapter(AbstractTreeViewer viewer, int style) {
super(viewer, style);
}
public void dragOver(DropTargetEvent event) {
Object oldTarget= fTarget;
super.dragOver(event);
if (oldTarget != fTarget) {
hoverStart= System.currentTimeMillis();
} else {
if (hoverStart > 0 && (System.currentTimeMillis() - hoverStart) > HOVER_THRESHOLD) {
expandSelection((TreeItem) event.item);
hoverStart= 0;
}
}
}
private void expandSelection(TreeItem item) {
if (item == null)
return;
Object element= item.getData();
if (element == null)
return;
((AbstractTreeViewer)getViewer()).expandToLevel(element, 1);
}
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.dnd;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.DropTargetListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.StructuredViewer;
/**
* An drag and drop adapter to be used together with structured viewers.
* The adpater delegates the <code>dragEnter</code>, <code>dragOperationChanged
* </code>, <code>dragOver</code> and <code>dropAccept</code> method to the <
* code>validateDrop</code> method. Furthermore it adds location feedback.
*/
public class JdtViewerDropAdapter implements DropTargetListener { |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | /**
* Constant describing the position of the cursor relative
* to the target object. This means the mouse is positioned
* slightly before the target.
*/
protected static final int LOCATION_BEFORE= 1;
/**
* Constant describing the position of the cursor relative
* to the target object. This means the mouse is positioned
* slightly after the target.
*/
protected static final int LOCATION_AFTER= 2;
/**
* Constant describing the position of the cursor relative
* to the target object. This means the mouse is positioned
* directly on the target.
*/ |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | protected static final int LOCATION_ON= 3;
/**
* Constant describing the position of the cursor relative
* to the target object. This means the mouse is not positioned
* over or near any valid target.
*/
protected static final int LOCATION_NONE= 4;
/**
* The threshold used to determine if the mouse is before or after
* a item.
*/
private static final int LOCATION_EPSILON= 5;
/**
* The threshold used to determine if the mouse is near the border
* and scrollinh should occur.
*/
private static final int SCROLL_EPSILON= 20;
/**
* Style to enable location feedback.
*/
public static final int INSERTION_FEEDBACK= 1 << 1;
private int fStyle;
private StructuredViewer fViewer;
private int fRequestedOperation;
private int fLastOperation;
private long fLastScroll; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | protected int fLocation;
protected Object fTarget;
public JdtViewerDropAdapter(StructuredViewer viewer, int style) {
fViewer= viewer;
Assert.isNotNull(fViewer);
fStyle= style;
fLastOperation= -1;
}
/**
* Returns the viewer this adapter is working on.
*/
protected StructuredViewer getViewer() {
return fViewer;
}
/**
* The actual drop has occurred. Calls <code>drop(Object target, DropTargetEvent event)
* </code>.
* @see DropTargetListener.drop(DropTargetEvent)
*/
public void drop(DropTargetEvent event) {
drop(fTarget, event);
}
/**
* The actual drop has occurred.
* @param target the drop target in form of a domain element.
* @param event the drop traget event |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | */
public void drop(Object target, DropTargetEvent event) {
}
/**
* Validates if the drop is valid. The method calls <code>validateDrop
* (Object target, DropTargetEvent event). Implementors can alter the
* <code>currentDataType</code> field and the <code>detail</code> field
* to give feedback about drop acceptence.
*/
public void validateDrop(DropTargetEvent event) {
validateDrop(fTarget, event, fRequestedOperation);
}
/**
* Validates if the drop on the current target is valid. The method
* can alter the <code>currentDataType</code> field and the <code>
* detail</code> field to give feedback about drop acceptence.
* @param target the drop target in form of a domain element.
* @param event the drop traget event
* @param operation the operation requested by the user.
*/
public void validateDrop(Object target, DropTargetEvent event, int operation) {
}
public void dragEnter(DropTargetEvent event) {
fLastScroll= System.currentTimeMillis();
dragOperationChanged(event);
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | public void dragLeave(DropTargetEvent event) {
fTarget= null;
fLocation= LOCATION_NONE;
fLastScroll= 0;
}
public void dragOperationChanged(DropTargetEvent event) {
fRequestedOperation= event.detail;
fTarget= computeTarget(event);
fLocation= computeLocation(event);
validateDrop(event);
fLastOperation= event.detail;
computeFeedback(event);
}
public void dragOver(DropTargetEvent event) {
Object oldTarget= fTarget;
fTarget= scrollIfNeeded(event.x, event.y);
if (fTarget == null)
fTarget= computeTarget(event);
int oldLocation= fLocation;
fLocation= computeLocation(event);
if (oldLocation != fLocation || oldTarget != fTarget || fLastOperation != event.detail) {
validateDrop(event);
fLastOperation= event.detail;
} else {
event.detail= fLastOperation; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | }
computeFeedback(event);
}
public void dropAccept(DropTargetEvent event) {
fTarget= computeTarget(event);
validateDrop(event);
fLastOperation= event.detail;
}
/**
* Returns the data hold by <code>event.item</code>. Inside a viewer
* this corresponds to the items data model element.
*/
protected Object computeTarget(DropTargetEvent event) {
return event.item == null ? null : event.item.getData();
}
/**
* Returns the position of the given coordinates relative to the given target.
* The position is determined to be before, after, or on the item, based on
* some threshold value. The return value is one of the LOCATION_* constants
* defined in this class.
*/
final protected int computeLocation(DropTargetEvent event) {
if (!(event.item instanceof Item)) {
return LOCATION_NONE;
}
Item item= (Item) event.item; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | Point coordinates= new Point(event.x, event.y);
coordinates= fViewer.getControl().toControl(coordinates);
Rectangle bounds= getBounds(item);
if (bounds == null) {
return LOCATION_NONE;
}
if ((coordinates.y - bounds.y) < LOCATION_EPSILON) {
return LOCATION_BEFORE;
}
if ((bounds.y + bounds.height - coordinates.y) < LOCATION_EPSILON) {
return LOCATION_AFTER;
}
return LOCATION_ON;
}
/**
* Returns the bounds of the given item, or <code>null</code> if it is not a
* valid type of item.
*/
private Rectangle getBounds(Item item) {
if (item instanceof TreeItem) {
return ((TreeItem) item).getBounds();
}
if (item instanceof TableItem) {
return ((TableItem) item).getBounds(0);
}
return null;
}
/**
* Scrolls the widget if the given coordinates are within epsilon
* of the widget borders. If scolling occurs, the viewer selection |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | * is set to be the newly revealed widget. Returns true if scrolling
* actually, occurred, and false otherwise.
*/
protected Object scrollIfNeeded(int x, int y) {
long time= System.currentTimeMillis();
if (time - fLastScroll < 500)
return null;
fLastScroll= time;
Control control= fViewer.getControl();
Point point= control.toControl(new Point(x, y));
Rectangle bounds= control.getBounds();
Item item= null;
if (point.y < SCROLL_EPSILON) {
item= fViewer.scrollUp(x, y);
} else {
if ((bounds.height - bounds.y - point.y) < SCROLL_EPSILON) {
item= fViewer.scrollDown(x, y);
}
}
if (item != null)
return item.getData();
return null;
}
/**
* Sets the drag under feedback corresponding to the value of <code>fLocation</code>
* and the <code>INSERTION_FEEDBACK</code> style bit. |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java | */
protected void computeFeedback(DropTargetEvent event) {
int old= event.feedback;
boolean insertionFeedback= (fStyle & INSERTION_FEEDBACK) != 0;
if (!insertionFeedback && fLocation != LOCATION_NONE) {
event.feedback= DND.FEEDBACK_SELECT;
} else {
if (fLocation == LOCATION_BEFORE) {
event.feedback= DND.FEEDBACK_INSERT_BEFORE;
} else if (fLocation == LOCATION_AFTER) {
event.feedback= DND.FEEDBACK_INSERT_AFTER;
}
}
}
/**
* Sets the dop operation to </code>DROP_NODE<code>.
*/
protected void clearDropOperation(DropTargetEvent event) {
event.detail= DND.DROP_NONE;
}
/**
* Returns the requested drop operation.
*/
protected int getRequestedOperation() {
return fRequestedOperation;
}
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | 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 java.util.ResourceBundle;
import org.eclipse.swt.SWT;
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; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java | 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.JdtTreeViewerDropAdapter;
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 JdtTreeViewerDropAdapter implements IOverwriteQuery, TransferDropTargetListener {
FileTransferDropAdapter(AbstractTreeViewer viewer) {
super(viewer, SWT.NONE);
}
public String queryOverwrite(String file) {
String[] returnCodes= {YES, NO, ALL, CANCEL};
int returnVal= openDialog(getViewer().getControl(), file);
return returnVal < 0 ? CANCEL : returnCodes[returnVal]; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java | }
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");
String msg= PackagesMessages.getFormattedString("DropAdapter.alreadyExists", file);
String[] options= {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL};
MessageDialog dialog= new MessageDialog(control.getShell(), title, null, msg, MessageDialog.QUESTION, options, 0);
result[0]= dialog.open();
}
});
return result[0];
}
public Transfer getTransfer() {
return FileTransfer.getInstance();
}
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; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java | if (!(isPackageFragment || isJavaProject || isPackageFragmentRoot))
return;
IJavaElement element= (IJavaElement)target;
if (!element.isReadOnly())
event.detail= DND.DROP_COPY;
return;
}
public void drop(Object javaTarget, 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;
try {
target= (IContainer)((IJavaElement)javaTarget).getCorrespondingResource();
} catch (JavaModelException e) {
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); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java | ProgressMonitorDialog dialog= new ProgressMonitorDialog(shell);
try {
dialog.run(true, true, op);
} catch (InvocationTargetException e) {
String title= PackagesMessages.getString("DropAdapter.errorTitle");
String message= PackagesMessages.getString("DropAdapter.errorMessage");
ExceptionHandler.handle(e, title, message);
return;
} catch (InterruptedException e) {
return;
}
IStatus status= op.getStatus();
if (! status.isOK()) {
String title= PackagesMessages.getString("DropAdapter.errorTitle");
String message= PackagesMessages.getString("DropAdapter.errorMessage");
ErrorDialog.openError(shell,
title,
message,
status, IStatus.ERROR | IStatus.WARNING);
return;
}
event.data= files.toArray(new String[files.size()]);
event.detail= DND.DROP_COPY;
return; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java | } 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());
} else if (path.isPrefixOf(target)) {
error= PackagesMessages.getFormattedString("DropAdapter.errorSubfolder", path.lastSegment());
}
if (error != null) {
MessageDialog.openError(shell, PackagesMessages.getString("DropAdapter.errorTitle"), error);
return new ArrayList(0);
}
if (target.isPrefixOf(path) && lengthCompare == path.segmentCount())
continue;
result.add(new File(file));
}
return result;
}
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.packageview;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IOpenable;
import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.IWorkingCopy;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ContextMenuGroup;
import org.eclipse.jdt.internal.ui.compare.JavaAddElementFromHistory;
import org.eclipse.jdt.internal.ui.compare.JavaReplaceWithEditionAction; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | import org.eclipse.jdt.internal.ui.dnd.DelegatingDragAdapter;
import org.eclipse.jdt.internal.ui.dnd.DelegatingDropAdapter;
import org.eclipse.jdt.internal.ui.dnd.LocalSelectionTransfer;
import org.eclipse.jdt.internal.ui.dnd.TransferDragSourceListener;
import org.eclipse.jdt.internal.ui.dnd.TransferDropTargetListener;
import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput;
import org.eclipse.jdt.internal.ui.preferences.JavaBasePreferencePage;
import org.eclipse.jdt.internal.ui.IPreferencesConstants;
import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringAction;
import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringGroup;
import org.eclipse.jdt.internal.ui.actions.StructuredSelectionProvider;
import org.eclipse.jdt.internal.ui.reorg.DeleteAction;
import org.eclipse.jdt.internal.ui.reorg.ReorgGroup;
import org.eclipse.jdt.internal.ui.search.JavaSearchGroup;
import org.eclipse.jdt.internal.ui.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.util.OpenTypeHierarchyUtil;
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementSorter;
import org.eclipse.jdt.internal.ui.viewsupport.MarkerErrorTickProvider;
import org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer;
import org.eclipse.jdt.internal.ui.viewsupport.StatusBarUpdater;
import org.eclipse.jdt.internal.ui.wizards.NewGroup;
import org.eclipse.jdt.ui.IContextMenuConstants;
import org.eclipse.jdt.ui.IPackagesViewPart;
import org.eclipse.jdt.ui.JavaElementContentProvider;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeViewerListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeExpansionEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.search.ui.IWorkingSet;
import org.eclipse.search.ui.SearchUI;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSource;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.KeyAdapter; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPartListener;
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.PartInitException;
import org.eclipse.ui.actions.OpenPerspectiveMenu;
import org.eclipse.ui.actions.OpenWithMenu;
import org.eclipse.ui.actions.RefreshAction;
import org.eclipse.ui.dialogs.PropertyDialogAction;
import org.eclipse.ui.help.ViewContextComputer;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.part.ISetSelectionTarget;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.internal.framelist.BackAction;
import org.eclipse.ui.views.internal.framelist.ForwardAction;
import org.eclipse.ui.views.internal.framelist.FrameList; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | import org.eclipse.ui.views.internal.framelist.GoIntoAction;
import org.eclipse.ui.views.internal.framelist.UpAction;
/**
* The ViewPart for the ProjectExplorer. It listens to part activation events.
* When selection linking with the editor is enabled the view selection tracks
* the active editor page. Similarly when a resource is selected in the packages
* view the corresponding editor is activated.
*/
public class PackageExplorerPart extends ViewPart implements ISetSelectionTarget, IMenuListener, IPackagesViewPart, IPropertyChangeListener {
public final static String VIEW_ID= JavaUI.ID_PACKAGES;
static final String TAG_SELECTION= "selection";
static final String TAG_EXPANDED= "expanded";
static final String TAG_ELEMENT= "element";
static final String TAG_PATH= "path";
static final String TAG_VERTICAL_POSITION= "verticalPosition";
static final String TAG_HORIZONTAL_POSITION= "horizontalPosition";
static final String TAG_FILTERS = "filters";
static final String TAG_FILTER = "filter";
static final String TAG_SHOWLIBRARIES = "showLibraries";
static final String TAG_SHOWBINARIES = "showBinaries";
static final String TAG_WORKINGSET = "workingset";
private JavaElementPatternFilter fPatternFilter= new JavaElementPatternFilter();
private LibraryFilter fLibraryFilter= new LibraryFilter();
private BinaryProjectFilter fBinaryFilter= new BinaryProjectFilter();
private WorkingSetFilter fWorkingSetFilter= new WorkingSetFilter();
private ProblemTreeViewer fViewer;
private PackagesFrameSource fFrameSource; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | private FrameList fFrameList;
private ContextMenuGroup[] fStandardGroups;
private Menu fContextMenu;
private OpenResourceAction fOpenCUAction;
private Action fOpenToAction;
private Action fShowTypeHierarchyAction;
private Action fShowNavigatorAction;
private Action fPropertyDialogAction;
private RefactoringAction fDeleteAction;
private RefreshAction fRefreshAction;
private BackAction fBackAction;
private ForwardAction fForwardAction;
private GoIntoAction fZoomInAction;
private UpAction fUpAction;
private GotoTypeAction fGotoTypeAction;
private GotoPackageAction fGotoPackageAction;
private AddBookmarkAction fAddBookmarkAction;
private FilterSelectionAction fFilterAction;
private ShowLibrariesAction fShowLibrariesAction;
private ShowBinariesAction fShowBinariesAction;
private FilterWorkingSetAction fFilterWorkingSetAction;
private RemoveWorkingSetFilterAction fRemoveWorkingSetAction;
private IMemento fMemento;
private ISelectionChangedListener fSelectionListener;
private IPartListener fPartListener= new IPartListener() {
public void partActivated(IWorkbenchPart part) {
if (part instanceof IEditorPart)
editorActivated((IEditorPart) part); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | }
public void partBroughtToTop(IWorkbenchPart part) {
}
public void partClosed(IWorkbenchPart part) {
}
public void partDeactivated(IWorkbenchPart part) {
}
public void partOpened(IWorkbenchPart part) {
}
};
private ITreeViewerListener fExpansionListener= new ITreeViewerListener() {
public void treeCollapsed(TreeExpansionEvent event) {
}
public void treeExpanded(TreeExpansionEvent event) {
Object element= event.getElement();
if (element instanceof ICompilationUnit ||
element instanceof IClassFile)
expandMainType(element);
}
};
public PackageExplorerPart() {
}
/* (non-Javadoc)
* Method declared on IViewPart.
*/
public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | fMemento= memento;
}
/**
* Initializes the default preferences
*/
public static void initDefaults(IPreferenceStore store) {
store.setDefault(TAG_SHOWLIBRARIES, true);
store.setDefault(TAG_SHOWBINARIES, true);
}
/**
* Returns the package explorer part of the active perspective. If
* there isn't any package explorer part <code>null</code> is returned.
*/
public static PackageExplorerPart getFromActivePerspective() {
IViewPart view= JavaPlugin.getActivePage().findView(VIEW_ID);
if (view instanceof PackageExplorerPart)
return (PackageExplorerPart)view;
return null;
}
/**
* Makes the package explorer part visible in the active perspective. If there
* isn't a package explorer part registered <code>null</code> is returned.
* Otherwise the opened view part is returned.
*/
public static PackageExplorerPart openInActivePerspective() {
try {
return (PackageExplorerPart)JavaPlugin.getActivePage().showView(VIEW_ID);
} catch(PartInitException pe) { |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | return null;
}
}
public void dispose() {
if (fViewer != null)
JavaPlugin.getDefault().getProblemMarkerManager().removeListener(fViewer);
if (fContextMenu != null && !fContextMenu.isDisposed())
fContextMenu.dispose();
getSite().getPage().removePartListener(fPartListener);
JavaPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
if (fViewer != null)
fViewer.removeTreeListener(fExpansionListener);
super.dispose();
}
/**
* Implementation of IWorkbenchPart.createPartControl(Composite)
*/
public void createPartControl(Composite parent) {
fViewer= new ProblemTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
boolean showCUChildren= JavaBasePreferencePage.showCompilationUnitChildren();
fViewer.setContentProvider(new JavaElementContentProvider(showCUChildren, false));
JavaPlugin.getDefault().getProblemMarkerManager().addListener(fViewer);
JavaPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
JavaElementLabelProvider labelProvider= new JavaElementLabelProvider(getLabelProviderFlags());
labelProvider.setErrorTickManager(new MarkerErrorTickProvider());
fViewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, null)); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | fViewer.setSorter(new JavaElementSorter());
fViewer.addFilter(new EmptyInnerPackageFilter());
fViewer.setUseHashlookup(true);
fViewer.addFilter(fPatternFilter);
fViewer.addFilter(fLibraryFilter);
fViewer.addFilter(fWorkingSetFilter);
if(fMemento != null)
restoreFilters();
else
initFilterFromPreferences();
fViewer.setInput(findInputElement());
initDragAndDrop();
initFrameList();
initKeyListener();
updateTitle();
MenuManager menuMgr= new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(this);
fContextMenu= menuMgr.createContextMenu(fViewer.getTree());
fViewer.getTree().setMenu(fContextMenu);
getSite().registerContextMenu(menuMgr, fViewer);
makeActions();
fSelectionListener= new ISelectionChangedListener() { |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | public void selectionChanged(SelectionChangedEvent event) {
handleSelectionChanged(event);
}
};
fViewer.addSelectionChangedListener(fSelectionListener);
fViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
handleDoubleClick(event);
}
});
fViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
handleKeyPressed(e);
}
});
getSite().setSelectionProvider(fViewer);
getSite().getPage().addPartListener(fPartListener);
IStatusLineManager slManager= getViewSite().getActionBars().getStatusLineManager();
fViewer.addSelectionChangedListener(new StatusBarUpdater(slManager));
fViewer.addTreeListener(fExpansionListener);
if (fMemento != null)
restoreState(fMemento);
fMemento= null;
WorkbenchHelp.setHelp(fViewer.getControl(), new ViewContextComputer(this, IJavaHelpContextIds.PACKAGE_VIEW));
fillActionBars(); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | }
private void fillActionBars() {
IActionBars actionBars= getViewSite().getActionBars();
IToolBarManager toolBar= actionBars.getToolBarManager();
toolBar.add(fBackAction);
toolBar.add(fForwardAction);
toolBar.add(fUpAction);
actionBars.updateActionBars();
IMenuManager menu= actionBars.getMenuManager();
menu.add(fFilterAction);
menu.add(fShowLibrariesAction);
menu.add(fFilterWorkingSetAction);
menu.add(fRemoveWorkingSetAction);
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end"));
}
private Object findInputElement() {
Object input= getSite().getPage().getInput();
if (input instanceof IWorkspace) {
return JavaCore.create(((IWorkspace)input).getRoot());
} else if (input instanceof IContainer) {
return JavaCore.create((IContainer)input);
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | return JavaCore.create(JavaPlugin.getWorkspace().getRoot());
}
/**
* Answer the property defined by key.
*/
public Object getAdapter(Class key) {
if (key.equals(ISelectionProvider.class))
return fViewer;
return super.getAdapter(key);
}
/**
* Returns the tool tip text for the given element.
*/
String getToolTipText(Object element) {
String result;
if (!(element instanceof IResource)) {
result= ((ILabelProvider) getViewer().getLabelProvider()).getText(element);
} else {
IPath path= ((IResource) element).getFullPath();
if (path.isRoot()) {
result= PackagesMessages.getString("PackageExplorer.title");
} else {
result= path.makeRelative().toString();
}
}
IWorkingSet ws= fWorkingSetFilter.getWorkingSet();
if (ws == null)
return result;
String wsstr= "Working Set: "+ws.getName(); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | if (result.length() == 0)
return wsstr;
return result + " - " + wsstr;
}
public String getTitleToolTip() {
if (fViewer == null)
return super.getTitleToolTip();
return getToolTipText(fViewer.getInput());
}
/**
* @see IWorkbenchPart#setFocus()
*/
public void setFocus() {
fViewer.getTree().setFocus();
}
/**
* Sets the working set to be used for filtering this part
*/
public void setWorkingSet(IWorkingSet ws) {
fWorkingSetFilter.setWorkingSet(ws);
firePropertyChange(IWorkbenchPart.PROP_TITLE);
fFilterWorkingSetAction.setChecked(ws != null);
fRemoveWorkingSetAction.setEnabled(ws != null);
}
/**
* Returns the shell to use for opening dialogs.
* Used in this class, and in the actions. |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | */
private Shell getShell() {
return fViewer.getTree().getShell();
}
/**
* Returns the selection provider.
*/
private ISelectionProvider getSelectionProvider() {
return fViewer;
}
/**
* Returns the current selection.
*/
private ISelection getSelection() {
return fViewer.getSelection();
}
/**
* Called when the context menu is about to open.
* Override to add your own context dependent menu contributions.
*/
public void menuAboutToShow(IMenuManager menu) {
JavaPlugin.createStandardGroups(menu);
IStructuredSelection selection= (IStructuredSelection) fViewer.getSelection();
boolean selectionHasElements= !selection.isEmpty();
Object element= selection.getFirstElement(); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | if (selection.size() == 1 && fViewer.isExpandable(element))
menu.appendToGroup(IContextMenuConstants.GROUP_GOTO, fZoomInAction);
addGotoMenu(menu);
fOpenCUAction.update();
if (fOpenCUAction.isEnabled())
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fOpenCUAction);
addOpenWithMenu(menu, selection);
addOpenToMenu(menu, selection);
addRefactoring(menu);
if (selection.size() == 1) {
menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, new JavaReplaceWithEditionAction(fViewer));
menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, new JavaAddElementFromHistory(null, fViewer));
}
ContextMenuGroup.add(menu, fStandardGroups, fViewer);
if (fAddBookmarkAction.canOperateOnSelection())
menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, fAddBookmarkAction);
menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, fRefreshAction);
fRefreshAction.selectionChanged(selection);
if (selectionHasElements) {
menu.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, fPropertyDialogAction);
}
}
void addGotoMenu(IMenuManager menu) {
MenuManager gotoMenu= new MenuManager(PackagesMessages.getString("PackageExplorer.gotoTitle")); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | menu.appendToGroup(IContextMenuConstants.GROUP_GOTO, gotoMenu);
gotoMenu.add(fBackAction);
gotoMenu.add(fForwardAction);
gotoMenu.add(fUpAction);
gotoMenu.add(fGotoTypeAction);
gotoMenu.add(fGotoPackageAction);
}
private void makeActions() {
ISelectionProvider provider= getSelectionProvider();
fOpenCUAction= new OpenResourceAction(provider);
fPropertyDialogAction= new PropertyDialogAction(getShell(), provider);
fShowNavigatorAction= new ShowInNavigatorAction(provider);
fAddBookmarkAction= new AddBookmarkAction(provider);
fStandardGroups= new ContextMenuGroup[] {
new NewGroup(),
new BuildGroup(),
new ReorgGroup(),
new JavaSearchGroup()
};
fDeleteAction= new DeleteAction(StructuredSelectionProvider.createFrom(provider));
fRefreshAction= new RefreshAction(getShell());
fFilterAction = new FilterSelectionAction(getShell(), this, PackagesMessages.getString("PackageExplorer.filters"));
fShowLibrariesAction = new ShowLibrariesAction(this, PackagesMessages.getString("PackageExplorer.referencedLibs"));
fShowBinariesAction = new ShowBinariesAction(getShell(), this, PackagesMessages.getString("PackageExplorer.binaryProjects"));
fFilterWorkingSetAction = new FilterWorkingSetAction(getShell(), this, "Filter Working Set...");
fRemoveWorkingSetAction = new RemoveWorkingSetFilterAction(getShell(), this, "Remove Working Set Filter"); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | fBackAction= new BackAction(fFrameList);
fForwardAction= new ForwardAction(fFrameList);
fZoomInAction= new GoIntoAction(fFrameList);
fUpAction= new UpAction(fFrameList);
fGotoTypeAction= new GotoTypeAction(this);
fGotoPackageAction= new GotoPackageAction(this);
IActionBars actionService= getViewSite().getActionBars();
actionService.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, fDeleteAction);
}
private void addRefactoring(IMenuManager menu){
MenuManager refactoring= new MenuManager(PackagesMessages.getString("PackageExplorer.refactoringTitle"));
ContextMenuGroup.add(refactoring, new ContextMenuGroup[] { new RefactoringGroup() }, fViewer);
if (!refactoring.isEmpty())
menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, refactoring);
}
private void addOpenToMenu(IMenuManager menu, IStructuredSelection selection) {
if (selection.size() != 1)
return;
IAdaptable element= (IAdaptable) selection.getFirstElement();
IResource resource= (IResource)element.getAdapter(IResource.class);
if ((resource instanceof IContainer)) {
MenuManager submenu = new MenuManager(PackagesMessages.getString("PackageExplorer.openPerspective"));
submenu.add(new OpenPerspectiveMenu(getSite().getWorkbenchWindow(), resource));
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
OpenTypeHierarchyUtil.addToMenu(getSite().getWorkbenchWindow(), menu, element);
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | private void addOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
if (selection.size() != 1)
return;
IAdaptable element= (IAdaptable)selection.getFirstElement();
Object resource= element.getAdapter(IResource.class);
if (!(resource instanceof IFile))
return;
MenuManager submenu= new MenuManager(PackagesMessages.getString("PackageExplorer.openWith"));
submenu.add(new OpenWithMenu(getSite().getPage(), (IFile) resource));
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
private boolean isSelectionOfType(ISelection s, Class clazz, boolean considerUnderlyingResource) {
if (! (s instanceof IStructuredSelection) || s.isEmpty())
return false;
IStructuredSelection selection= (IStructuredSelection)s;
Iterator iter= selection.iterator();
while (iter.hasNext()) {
Object o= iter.next();
if (clazz.isInstance(o))
return true;
if (considerUnderlyingResource) {
if (! (o instanceof IJavaElement))
return false; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | IJavaElement element= (IJavaElement)o;
Object resource= element.getAdapter(IResource.class);
if (! clazz.isInstance(resource))
return false;
}
}
return true;
}
private void initDragAndDrop() {
int ops= DND.DROP_COPY | DND.DROP_MOVE;
final LocalSelectionTransfer lt= LocalSelectionTransfer.getInstance();
Transfer[] transfers= new Transfer[] {lt, FileTransfer.getInstance()};
TransferDropTargetListener[] dropListeners= new TransferDropTargetListener[] {
new SelectionTransferDropAdapter(fViewer),
new FileTransferDropAdapter(fViewer)
};
fViewer.addDropSupport(ops, transfers, new DelegatingDropAdapter(dropListeners));
Control control= fViewer.getControl();
TransferDragSourceListener[] dragListeners= new TransferDragSourceListener[] {
new SelectionTransferDragAdapter(fViewer),
new FileTransferDragAdapter(fViewer)
};
DragSource source= new DragSource(control, ops); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | source.addDragListener(new DelegatingDragAdapter(dragListeners));
}
/**
* Handles key events in viewer.
*/
void handleKeyPressed(KeyEvent event) {
if (event.character == SWT.DEL && event.stateMask == 0){
fDeleteAction.update();
if (fDeleteAction.isEnabled())
fDeleteAction.run();
}
}
/**
* Handles double clicks in viewer.
* Opens editor if file double-clicked.
*/
private void handleDoubleClick(DoubleClickEvent event) {
IStructuredSelection s= (IStructuredSelection) event.getSelection();
Object element= s.getFirstElement();
if (fOpenCUAction.isEnabled()) {
fOpenCUAction.run();
return;
}
if (fViewer.isExpandable(element)) {
if (JavaBasePreferencePage.doubleClockGoesInto()) { |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | if (element instanceof IOpenable &&
!(element instanceof ICompilationUnit) &&
!(element instanceof IClassFile)) {
fZoomInAction.run();
}
} else {
fViewer.setExpandedState(element, !fViewer.getExpandedState(element));
}
}
}
/**
* Handles selection changed in viewer.
* Updates global actions.
* Links to editor (if option enabled)
*/
private void handleSelectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel= (IStructuredSelection) event.getSelection();
fZoomInAction.update();
linkToEditor(sel);
}
public void selectReveal(ISelection selection) {
ISelection javaSelection= convertSelection(selection);
fViewer.setSelection(javaSelection, true);
}
private ISelection convertSelection(ISelection s) {
List converted= new ArrayList();
if (s instanceof StructuredSelection) {
Object[] elements= ((StructuredSelection)s).toArray(); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | for (int i= 0; i < elements.length; i++) {
Object e= elements[i];
if (e instanceof IJavaElement)
converted.add(e);
else if (e instanceof IResource) {
IJavaElement element= JavaCore.create((IResource)e);
if (element != null)
converted.add(element);
else
converted.add(e);
}
}
}
return new StructuredSelection(converted.toArray());
}
public void selectAndReveal(Object element) {
selectReveal(new StructuredSelection(element));
}
/**
* Returns whether the preference to link selection to active editor is enabled.
*/
boolean isLinkingEnabled() {
return JavaBasePreferencePage.linkPackageSelectionToEditor();
}
/**
* Links to editor (if option enabled)
*/
private void linkToEditor(IStructuredSelection selection) { |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | Object obj= selection.getFirstElement();
Object element= null;
if (selection.size() == 1) {
if (obj instanceof IJavaElement) {
IJavaElement cu= JavaModelUtil.findElementOfKind((IJavaElement)obj, IJavaElement.COMPILATION_UNIT);
if (cu != null)
element= getResourceFor(cu);
if (element == null)
element= JavaModelUtil.findElementOfKind((IJavaElement)obj, IJavaElement.CLASS_FILE);
}
else if (obj instanceof IFile)
element= obj;
if (element == null)
return;
IWorkbenchPage page= getSite().getPage();
IEditorPart editorArray[]= page.getEditors();
for (int i= 0; i < editorArray.length; ++i) {
IEditorPart editor= editorArray[i];
Object input= getElementOfInput(editor.getEditorInput());
if (input != null && input.equals(element)) {
page.bringToTop(editor);
if (obj instanceof IJavaElement)
EditorUtility.revealInEditor(editor, (IJavaElement) obj);
return;
}
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | }
}
private IResource getResourceFor(Object element) {
if (element instanceof IJavaElement) {
if (element instanceof IWorkingCopy) {
IWorkingCopy wc= (IWorkingCopy)element;
IJavaElement original= wc.getOriginalElement();
if (original != null)
element= original;
}
try {
element= ((IJavaElement)element).getUnderlyingResource();
} catch (JavaModelException e) {
return null;
}
}
if (!(element instanceof IResource) || ((IResource)element).isPhantom()) {
return null;
}
return (IResource)element;
}
public void saveState(IMemento memento) {
if (fViewer == null) {
if (fMemento != null)
memento.putMemento(fMemento);
return;
}
saveExpansionState(memento); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | saveSelectionState(memento);
saveScrollState(memento, fViewer.getTree());
savePatternFilterState(memento);
saveFilterState(memento);
saveWorkingSetState(memento);
}
protected void saveFilterState(IMemento memento) {
boolean showLibraries= getLibraryFilter().getShowLibraries();
String show= "true";
if (!showLibraries)
show= "false";
memento.putString(TAG_SHOWLIBRARIES, show);
boolean showBinaries= getBinaryFilter().getShowBinaries();
String showBinString= "true";
if (!showBinaries)
showBinString= "false";
memento.putString(TAG_SHOWBINARIES, showBinString);
}
protected void savePatternFilterState(IMemento memento) {
String filters[] = getPatternFilter().getPatterns();
if(filters.length > 0) {
IMemento filtersMem = memento.createChild(TAG_FILTERS);
for (int i = 0; i < filters.length; i++){
IMemento child = filtersMem.createChild(TAG_FILTER);
child.putString(TAG_ELEMENT,filters[i]);
}
}
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | protected void saveScrollState(IMemento memento, Tree tree) {
ScrollBar bar= tree.getVerticalBar();
int position= bar != null ? bar.getSelection() : 0;
memento.putString(TAG_VERTICAL_POSITION, String.valueOf(position));
bar= tree.getHorizontalBar();
position= bar != null ? bar.getSelection() : 0;
memento.putString(TAG_HORIZONTAL_POSITION, String.valueOf(position));
}
protected void saveSelectionState(IMemento memento) {
Object elements[]= ((IStructuredSelection) fViewer.getSelection()).toArray();
if (elements.length > 0) {
IMemento selectionMem= memento.createChild(TAG_SELECTION);
for (int i= 0; i < elements.length; i++) {
IMemento elementMem= selectionMem.createChild(TAG_ELEMENT);
Object o= elements[i];
if (o instanceof IJavaElement)
elementMem.putString(TAG_PATH, ((IJavaElement) elements[i]).getHandleIdentifier());
}
}
}
protected void saveExpansionState(IMemento memento) {
Object expandedElements[]= fViewer.getExpandedElements();
if (expandedElements.length > 0) {
IMemento expandedMem= memento.createChild(TAG_EXPANDED);
for (int i= 0; i < expandedElements.length; i++) {
IMemento elementMem= expandedMem.createChild(TAG_ELEMENT);
Object o= expandedElements[i]; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | if (o instanceof IJavaElement)
elementMem.putString(TAG_PATH, ((IJavaElement) expandedElements[i]).getHandleIdentifier());
}
}
}
protected void saveWorkingSetState(IMemento memento) {
IWorkingSet ws= getWorkingSetFilter().getWorkingSet();
if (ws != null) {
memento.putString(TAG_WORKINGSET, ws.getName());
}
}
void restoreState(IMemento memento) {
restoreExpansionState(memento);
restoreSelectionState(memento);
restoreScrollState(memento, fViewer.getTree());
}
protected void restoreScrollState(IMemento memento, Tree tree) {
ScrollBar bar= tree.getVerticalBar();
if (bar != null) {
try {
String posStr= memento.getString(TAG_VERTICAL_POSITION);
int position;
position= new Integer(posStr).intValue();
bar.setSelection(position);
} catch (NumberFormatException e) {
}
}
bar= tree.getHorizontalBar();
if (bar != null) { |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | try {
String posStr= memento.getString(TAG_HORIZONTAL_POSITION);
int position;
position= new Integer(posStr).intValue();
bar.setSelection(position);
} catch (NumberFormatException e) {
}
}
}
protected void restoreSelectionState(IMemento memento) {
IMemento childMem;
childMem= memento.getChild(TAG_SELECTION);
if (childMem != null) {
ArrayList list= new ArrayList();
IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT);
for (int i= 0; i < elementMem.length; i++) {
Object element= JavaCore.create(elementMem[i].getString(TAG_PATH));
list.add(element);
}
fViewer.setSelection(new StructuredSelection(list));
}
}
protected void restoreExpansionState(IMemento memento) {
IMemento childMem= memento.getChild(TAG_EXPANDED);
if (childMem != null) {
ArrayList elements= new ArrayList();
IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT);
for (int i= 0; i < elementMem.length; i++) {
Object element= JavaCore.create(elementMem[i].getString(TAG_PATH)); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | elements.add(element);
}
fViewer.setExpandedElements(elements.toArray());
}
}
/**
* Create the KeyListener for doing the refresh on the viewer.
*/
private void initKeyListener() {
fViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent event) {
doKeyPressed(event.keyCode);
}
});
}
private void doKeyPressed(int key) {
if (key == SWT.F5) {
fRefreshAction.selectionChanged(
(IStructuredSelection) fViewer.getSelection());
if (fRefreshAction.isEnabled())
fRefreshAction.run();
} else if (key == SWT.F4) {
OpenTypeHierarchyUtil.open(getSelection(), getSite().getWorkbenchWindow());
} else if (key == SWT.F3) {
fOpenCUAction.update();
if (fOpenCUAction.isEnabled())
fOpenCUAction.run();
}
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | void initFrameList() {
fFrameSource= new PackagesFrameSource(this);
fFrameList= new FrameList(fFrameSource);
fFrameSource.connectTo(fFrameList);
}
/**
* An editor has been activated. Set the selection in this Packages Viewer
* to be the editor's input, if linking is enabled.
*/
void editorActivated(IEditorPart editor) {
if (!isLinkingEnabled())
return;
Object input= getElementOfInput(editor.getEditorInput());
Object element= null;
if (input instanceof IFile)
element= JavaCore.create((IFile)input);
if (element == null)
element= input;
if (element != null) {
IStructuredSelection oldSelection= (IStructuredSelection)getSelection();
if (oldSelection.size() == 1) {
Object o= oldSelection.getFirstElement();
if (o instanceof IMember) {
IMember m= (IMember)o; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | if (element.equals(m.getCompilationUnit()))
return;
if (element.equals(m.getClassFile()))
return;
}
}
ISelection newSelection= new StructuredSelection(element);
if (!fViewer.getSelection().equals(newSelection)) {
try {
fViewer.removeSelectionChangedListener(fSelectionListener);
fViewer.setSelection(newSelection);
} finally {
fViewer.addSelectionChangedListener(fSelectionListener);
}
}
}
}
/**
* A compilation unit or class was expanded, expand
* the main type.
*/
void expandMainType(Object element) {
try {
IType type= null;
if (element instanceof ICompilationUnit) {
ICompilationUnit cu= (ICompilationUnit)element;
IType[] types= cu.getTypes();
if (types.length > 0)
type= types[0]; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | }
else if (element instanceof IClassFile) {
IClassFile cf= (IClassFile)element;
type= cf.getType();
}
if (type != null) {
final IType type2= type;
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
ctrl.getDisplay().asyncExec(new Runnable() {
public void run() {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed())
fViewer.expandToLevel(type2, 1);
}
});
}
}
} catch(JavaModelException e) {
}
}
/**
* Returns the element contained in the EditorInput
*/
Object getElementOfInput(IEditorInput input) {
if (input instanceof IClassFileEditorInput)
return ((IClassFileEditorInput)input).getClassFile();
else if (input instanceof IFileEditorInput) |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | return ((IFileEditorInput)input).getFile();
else if (input instanceof JarEntryEditorInput)
return ((JarEntryEditorInput)input).getStorage();
return null;
}
/**
* Returns the Viewer.
*/
TreeViewer getViewer() {
return fViewer;
}
/**
* Returns the pattern filter for this view.
* @return the pattern filter
*/
JavaElementPatternFilter getPatternFilter() {
return fPatternFilter;
}
/**
* Returns the library filter for this view.
* @return the library filter
*/
LibraryFilter getLibraryFilter() {
return fLibraryFilter;
}
/**
* Returns the working set filter for this view. |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | * @return the working set filter
*/
WorkingSetFilter getWorkingSetFilter() {
return fWorkingSetFilter;
}
/**
* Returns the Binary filter for this view.
* @return the binary filter
*/
BinaryProjectFilter getBinaryFilter() {
return fBinaryFilter;
}
void restoreFilters() {
IMemento filtersMem= fMemento.getChild(TAG_FILTERS);
if(filtersMem != null) {
IMemento children[]= filtersMem.getChildren(TAG_FILTER);
String filters[]= new String[children.length];
for (int i = 0; i < children.length; i++) {
filters[i]= children[i].getString(TAG_ELEMENT);
}
getPatternFilter().setPatterns(filters);
} else {
getPatternFilter().setPatterns(new String[0]);
}
String show= fMemento.getString(TAG_SHOWLIBRARIES);
if (show != null)
getLibraryFilter().setShowLibraries(show.equals("true"));
else
initLibraryFilterFromPreferences(); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | String showbin= fMemento.getString(TAG_SHOWBINARIES);
if (showbin != null)
getBinaryFilter().setShowBinaries(showbin.equals("true"));
else
initBinaryFilterFromPreferences();
String workingSetName= fMemento.getString(TAG_WORKINGSET);
if (workingSetName != null) {
IWorkingSet ws= SearchUI.findWorkingSet(workingSetName);
if (ws != null) {
getWorkingSetFilter().setWorkingSet(ws);
}
}
}
void initFilterFromPreferences() {
initBinaryFilterFromPreferences();
initLibraryFilterFromPreferences();
}
void initLibraryFilterFromPreferences() {
JavaPlugin plugin= JavaPlugin.getDefault();
boolean show= plugin.getPreferenceStore().getBoolean(TAG_SHOWLIBRARIES);
getLibraryFilter().setShowLibraries(show);
}
void initBinaryFilterFromPreferences() {
JavaPlugin plugin= JavaPlugin.getDefault();
boolean showbin= plugin.getPreferenceStore().getBoolean(TAG_SHOWBINARIES); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | getBinaryFilter().setShowBinaries(showbin);
}
/**
* Updates the title text and title tool tip.
* Called whenever the input of the viewer changes.
*/
void updateTitle() {
Object input= getViewer().getInput();
String viewName= getConfigurationElement().getAttribute("name");
if (input == null
|| (input instanceof IJavaModel)) {
setTitle(viewName);
setTitleToolTip("");
} else {
ILabelProvider labelProvider = (ILabelProvider) getViewer().getLabelProvider();
String inputText= labelProvider.getText(input);
String title= PackagesMessages.getFormattedString("PackageExplorer.argTitle", new String[] { viewName, inputText });
setTitle(title);
setTitleToolTip(getToolTipText(input));
}
}
/**
* Sets the decorator for the package explorer.
*
* @param decorator a label decorator or <code>null</code> for no decorations.
*/
public void setLabelDecorator(ILabelDecorator decorator) {
JavaElementLabelProvider javaProvider= new JavaElementLabelProvider(getLabelProviderFlags());
javaProvider.setErrorTickManager(new MarkerErrorTickProvider()); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java | if (decorator == null) {
fViewer.setLabelProvider(javaProvider);
} else {
fViewer.setLabelProvider(new DecoratingLabelProvider(javaProvider, decorator));
}
}
/**
* Gets the standard label flags
*/
private int getLabelProviderFlags() {
return JavaElementLabelProvider.SHOW_BASICS | JavaElementLabelProvider.SHOW_OVERLAY_ICONS |
JavaElementLabelProvider.SHOW_SMALL_ICONS | JavaElementLabelProvider.SHOW_VARIABLE | JavaElementLabelProvider.SHOW_PARAMETERS;
}
/*
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty() != IPreferencesConstants.SHOW_CU_CHILDREN)
return;
if (fViewer != null) {
IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
boolean b= store.getBoolean(IPreferencesConstants.SHOW_CU_CHILDREN);
((JavaElementContentProvider)fViewer.getContentProvider()).setProvideMembers(b);
fViewer.refresh();
}
}
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/SelectionTransferDropAdapter.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/ |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/SelectionTransferDropAdapter.java | package org.eclipse.jdt.internal.ui.packageview;
import java.util.List;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.refactoring.Assert;
import org.eclipse.jdt.internal.core.refactoring.reorg.CopyRefactoring;
import org.eclipse.jdt.internal.core.refactoring.reorg.MoveRefactoring;
import org.eclipse.jdt.internal.core.refactoring.reorg.ReorgRefactoring;
import org.eclipse.jdt.internal.core.refactoring.text.ITextBufferChangeCreator;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.dnd.JdtTreeViewerDropAdapter;
import org.eclipse.jdt.internal.ui.dnd.LocalSelectionTransfer;
import org.eclipse.jdt.internal.ui.dnd.TransferDropTargetListener;
import org.eclipse.jdt.internal.ui.actions.StructuredSelectionProvider;
import org.eclipse.jdt.internal.ui.refactoring.changes.DocumentTextBufferChangeCreator;
import org.eclipse.jdt.internal.ui.reorg.CopyAction;
import org.eclipse.jdt.internal.ui.reorg.MoveAction;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.texteditor.IDocumentProvider;
public class SelectionTransferDropAdapter extends JdtTreeViewerDropAdapter implements TransferDropTargetListener { |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/SelectionTransferDropAdapter.java | private List fElements;
private MoveRefactoring fMoveRefactoring;
private int fCanMoveElements;
private CopyRefactoring fCopyRefactoring;
private int fCanCopyElements;
public SelectionTransferDropAdapter(AbstractTreeViewer viewer) {
super(viewer, SWT.NONE);
}
public Transfer getTransfer() {
return LocalSelectionTransfer.getInstance();
}
public void dragEnter(DropTargetEvent event) {
clear();
super.dragEnter(event);
}
public void dragLeave(DropTargetEvent event) {
clear();
super.dragLeave(event);
}
private void clear() {
fElements= null;
fMoveRefactoring= null;
fCanMoveElements= 0; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/SelectionTransferDropAdapter.java | fCopyRefactoring= null;
fCanCopyElements= 0;
}
public void validateDrop(Object target, DropTargetEvent event, int operation) {
event.detail= DND.DROP_NONE;
if (fElements == null) {
ISelection s= LocalSelectionTransfer.getInstance().getSelection();
if (!(s instanceof IStructuredSelection))
return;
fElements= ((IStructuredSelection)s).toList();
}
boolean success= false;
try {
if (operation == DND.DROP_COPY) {
success= handleValidateCopy(target, event);
} else if (operation == DND.DROP_MOVE) {
success= handleValidateMove(target, event);
}
} catch (JavaModelException e){
ExceptionHandler.handle(e, "Drag'n'drop", "Unexpected exception. See log for details.");
success= false;
}
if (success)
event.detail= operation;
}
public void drop(Object target, DropTargetEvent event) {
try{
if (event.detail == DND.DROP_MOVE) { |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/SelectionTransferDropAdapter.java | handleDropMove(target, event);
} else if (event.detail == DND.DROP_COPY) {
handleDropCopy(target, event);
}
event.detail= DND.DROP_NONE;
} catch (JavaModelException e){
ExceptionHandler.handle(e, "Drag'n'drop", "Unexpected exception. See log for details.");
}
}
private boolean handleValidateMove(Object target, DropTargetEvent event) throws JavaModelException{
if (fMoveRefactoring == null){
IDocumentProvider documentProvider= JavaPlugin.getDefault().getCompilationUnitDocumentProvider();
ITextBufferChangeCreator changeCreator= new DocumentTextBufferChangeCreator(documentProvider);
fMoveRefactoring= new MoveRefactoring(fElements, changeCreator);
}
if (!canMoveElements())
return false;
return fMoveRefactoring.isValidDestination(target);
}
private boolean canMoveElements() {
if (fCanMoveElements == 0) {
fCanMoveElements= 2; |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/SelectionTransferDropAdapter.java | if (! canActivate(fMoveRefactoring))
fCanMoveElements= 1;
}
return fCanMoveElements == 2;
}
private boolean canActivate(ReorgRefactoring ref){
try{
return ref.checkActivation(new NullProgressMonitor()).isOK();
} catch(JavaModelException e){
ExceptionHandler.handle(e, "Drag'n'drop", "Unexpected exception. See log for details.");
return false;
}
}
private void handleDropMove(final Object target, DropTargetEvent event) throws JavaModelException{
new DragNDropMoveAction(StructuredSelectionProvider.createFrom(getViewer()), target).run();
}
private boolean handleValidateCopy(Object target, DropTargetEvent event) throws JavaModelException{
if (fCopyRefactoring == null)
fCopyRefactoring= new CopyRefactoring(fElements);
if (!canCopyElements())
return false;
return fCopyRefactoring.isValidDestination(target);
}
private boolean canCopyElements() {
if (fCanCopyElements == 0) { |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/SelectionTransferDropAdapter.java | fCanCopyElements= 2;
if (!canActivate(fCopyRefactoring))
fCanCopyElements= 1;
}
return fCanCopyElements == 2;
}
private void handleDropCopy(final Object target, DropTargetEvent event) throws JavaModelException{
CopyAction action= new CopyAction("#COPY", StructuredSelectionProvider.createFrom(getViewer())){
protected Object selectDestination(ReorgRefactoring ref) {
return target;
}
};
action.run();
}
private static class DragNDropMoveAction extends MoveAction{
private Object fTarget;
private static final int PREVIEW_ID= IDialogConstants.CLIENT_ID + 1;
public DragNDropMoveAction(StructuredSelectionProvider provider, Object target){
super("#MOVE", provider);
Assert.isNotNull(target);
fTarget= target;
}
protected Object selectDestination(ReorgRefactoring ref) {
return fTarget;
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/SelectionTransferDropAdapter.java | protected boolean isOkToProceed(ReorgRefactoring refactoring) throws JavaModelException{
if (!super.isOkToProceed(refactoring))
return false;
return askIfUpdateReferences((MoveRefactoring)refactoring);
}
private boolean askIfUpdateReferences(MoveRefactoring ref) throws JavaModelException{
if (! ref.canUpdateReferences()){
setShowPreview(false);
return true;
}
switch (askIfUpdateReferences()){
case IDialogConstants.CANCEL_ID:
setShowPreview(false);
return false;
case IDialogConstants.NO_ID:
ref.setUpdateReferences(false);
setShowPreview(false);
return true;
case IDialogConstants.YES_ID:
ref.setUpdateReferences(true);
setShowPreview(false);
return true;
case PREVIEW_ID:
ref.setUpdateReferences(true);
setShowPreview(true);
return true;
default: |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/SelectionTransferDropAdapter.java | Assert.isTrue(false);
return false;
}
}
private static int askIfUpdateReferences(){
Shell shell= JavaPlugin.getActiveWorkbenchShell().getShell();
String title= "Move";
String preview= "Pre&view";
String question= "Do you want to update references to the moved element(s)? Press '" + preview + "' to see the preview of the reference updates.";
String[] labels= new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
preview, IDialogConstants.CANCEL_LABEL };
final MessageDialog dialog = new MessageDialog(shell, title, null, question, MessageDialog.QUESTION, labels, 2);
shell.getDisplay().syncExec(new Runnable() {
public void run() {
dialog.open();
}
});
int result = dialog.getReturnCode();
if (result == 0)
return IDialogConstants.YES_ID;
if (result == 1)
return IDialogConstants.NO_ID;
if (result == 2)
return PREVIEW_ID;
return IDialogConstants.CANCEL_ID;
}
}
} |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyTransferDropAdapter.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.typehierarchy;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.internal.ui.actions.AddMethodStubAction;
import org.eclipse.jdt.internal.ui.dnd.JdtTreeViewerDropAdapter;
import org.eclipse.jdt.internal.ui.dnd.LocalSelectionTransfer;
import org.eclipse.jdt.internal.ui.dnd.TransferDropTargetListener;
public class TypeHierarchyTransferDropAdapter extends JdtTreeViewerDropAdapter implements TransferDropTargetListener {
private AddMethodStubAction fAddMethodStubAction;
public TypeHierarchyTransferDropAdapter(AbstractTreeViewer viewer) {
super(viewer, SWT.NONE);
fAddMethodStubAction= new AddMethodStubAction();
}
public Transfer getTransfer() {
return LocalSelectionTransfer.getInstance(); |
5,699 | Bug 5699 Add ResourceTransfer to packages view | The packages view should add the ResoruceTransfer as a drag source to its list of transfers | resolved fixed | eb077ff | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T15:13:53Z" | "2001-11-09T10:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyTransferDropAdapter.java | }
public void validateDrop(Object target, DropTargetEvent event, int operation) {
event.detail= DND.DROP_NONE;
ISelection selection= LocalSelectionTransfer.getInstance().getSelection();
if (target instanceof IType) {
if (AddMethodStubAction.canActionBeAdded((IType)target, selection)) {
if (operation == DND.DROP_NONE) {
operation= DND.DROP_COPY;
}
event.detail= operation;
}
}
return;
}
public void drop(Object target, DropTargetEvent event) {
ISelection selection= LocalSelectionTransfer.getInstance().getSelection();
if (target instanceof IType) {
if (fAddMethodStubAction.init((IType)target, selection)) {
fAddMethodStubAction.run();
}
}
return;
}
} |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards.buildpaths;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite; |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject; |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.JavaRuntime;
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.dialogs.ElementTreeSelectionDialog;
import org.eclipse.jdt.internal.ui.dialogs.ISelectionValidator;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
import org.eclipse.jdt.internal.ui.preferences.JavaBasePreferencePage;
import org.eclipse.jdt.internal.ui.util.CoreUtility;
import org.eclipse.jdt.internal.ui.util.SWTUtil;
import org.eclipse.jdt.internal.ui.util.TabFolderLayout;
import org.eclipse.jdt.internal.ui.viewsupport.ImageDisposer;
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator;
import org.eclipse.jdt.internal.ui.wizards.TypedViewerFilter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.CheckedListDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
import org.eclipse.jdt.internal.ui.wizards.swt.MGridData;
import org.eclipse.jdt.internal.ui.wizards.swt.MGridLayout;
public class BuildPathsBlock { |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | private IWorkspaceRoot fWorkspaceRoot;
private CheckedListDialogField fClassPathList;
private StringDialogField fBuildPathDialogField;
private StatusInfo fClassPathStatus;
private StatusInfo fBuildPathStatus;
private IJavaProject fCurrJProject;
private IPath fOutputLocationPath;
private IStatusChangeListener fContext;
private Control fSWTWidget;
private boolean fIsNewProject;
private SourceContainerWorkbookPage fSourceContainerPage;
private ProjectsWorkbookPage fProjectsPage;
private LibrariesWorkbookPage fLibrariesPage;
private BuildPathBasePage fCurrPage;
public BuildPathsBlock(IWorkspaceRoot root, IStatusChangeListener context, boolean isNewProject) {
fWorkspaceRoot= root;
fContext= context;
fIsNewProject= isNewProject;
fSourceContainerPage= null;
fLibrariesPage= null;
fProjectsPage= null; |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | fCurrPage= null;
BuildPathAdapter adapter= new BuildPathAdapter();
String[] buttonLabels= new String[] {
NewWizardMessages.getString("BuildPathsBlock.classpath.up.button"),
NewWizardMessages.getString("BuildPathsBlock.classpath.down.button"),
null,
NewWizardMessages.getString("BuildPathsBlock.classpath.checkall.button"),
NewWizardMessages.getString("BuildPathsBlock.classpath.uncheckall.button")
};
fClassPathList= new CheckedListDialogField(null, buttonLabels, new CPListLabelProvider());
fClassPathList.setDialogFieldListener(adapter);
fClassPathList.setLabelText(NewWizardMessages.getString("BuildPathsBlock.classpath.label"));
fClassPathList.setUpButtonIndex(0);
fClassPathList.setDownButtonIndex(1);
fClassPathList.setCheckAllButtonIndex(3);
fClassPathList.setUncheckAllButtonIndex(4);
if (isNewProject) {
fBuildPathDialogField= new StringDialogField();
} else {
StringButtonDialogField dialogField= new StringButtonDialogField(adapter);
dialogField.setButtonLabel(NewWizardMessages.getString("BuildPathsBlock.buildpath.button"));
fBuildPathDialogField= dialogField;
}
fBuildPathDialogField.setDialogFieldListener(adapter);
fBuildPathDialogField.setLabelText(NewWizardMessages.getString("BuildPathsBlock.buildpath.label")); |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | fBuildPathStatus= new StatusInfo();
fClassPathStatus= new StatusInfo();
fCurrJProject= null;
}
public Control createControl(Composite parent) {
fSWTWidget= parent;
Composite composite= new Composite(parent, SWT.NONE);
MGridLayout layout= new MGridLayout();
layout.marginWidth= 0;
layout.minimumWidth= SWTUtil.convertWidthInCharsToPixels(80, composite);
layout.minimumHeight= SWTUtil.convertHeightInCharsToPixels(20, composite);
layout.numColumns= 1;
composite.setLayout(layout);
TabFolder folder= new TabFolder(composite, SWT.NONE);
folder.setLayout(new TabFolderLayout());
folder.setLayoutData(new MGridData(MGridData.FILL_BOTH));
folder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
tabChanged(e.item);
}
});
ImageRegistry imageRegistry= JavaPlugin.getDefault().getImageRegistry(); |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | TabItem item;
fSourceContainerPage= new SourceContainerWorkbookPage(fWorkspaceRoot, fClassPathList, fBuildPathDialogField, fIsNewProject);
item= new TabItem(folder, SWT.NONE);
item.setText(NewWizardMessages.getString("BuildPathsBlock.tab.source"));
item.setImage(imageRegistry.get(JavaPluginImages.IMG_OBJS_PACKFRAG_ROOT));
item.setData(fSourceContainerPage);
item.setControl(fSourceContainerPage.getControl(folder));
IWorkbench workbench= JavaPlugin.getDefault().getWorkbench();
Image projectImage= workbench.getSharedImages().getImage(ISharedImages.IMG_OBJ_PROJECT);
fProjectsPage= new ProjectsWorkbookPage(fClassPathList);
item= new TabItem(folder, SWT.NONE);
item.setText(NewWizardMessages.getString("BuildPathsBlock.tab.projects"));
item.setImage(projectImage);
item.setData(fProjectsPage);
item.setControl(fProjectsPage.getControl(folder));
fLibrariesPage= new LibrariesWorkbookPage(fWorkspaceRoot, fClassPathList);
item= new TabItem(folder, SWT.NONE);
item.setText(NewWizardMessages.getString("BuildPathsBlock.tab.libraries"));
item.setImage(imageRegistry.get(JavaPluginImages.IMG_OBJS_LIBRARY));
item.setData(fLibrariesPage);
item.setControl(fLibrariesPage.getControl(folder));
Image cpoImage= JavaPluginImages.DESC_TOOL_CLASSPATH_ORDER.createImage();
composite.addDisposeListener(new ImageDisposer(cpoImage)); |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | ClasspathOrderingWorkbookPage ordpage= new ClasspathOrderingWorkbookPage(fClassPathList);
item= new TabItem(folder, SWT.NONE);
item.setText(NewWizardMessages.getString("BuildPathsBlock.tab.order"));
item.setImage(cpoImage);
item.setData(ordpage);
item.setControl(ordpage.getControl(folder));
if (fCurrJProject != null) {
fSourceContainerPage.init(fCurrJProject);
fLibrariesPage.init(fCurrJProject);
fProjectsPage.init(fCurrJProject);
}
Composite editorcomp= new Composite(composite, SWT.NONE);
DialogField[] editors= new DialogField[] { fBuildPathDialogField };
LayoutUtil.doDefaultLayout(editorcomp, editors, true, 0, 0, 0, 0);
editorcomp.setLayoutData(new MGridData(MGridData.FILL_HORIZONTAL));
if (fIsNewProject) {
folder.setSelection(0);
fCurrPage= fSourceContainerPage;
} else {
folder.setSelection(3);
fCurrPage= ordpage;
}
WorkbenchHelp.setHelp(composite, new Object[] { IJavaHelpContextIds.BUILD_PATH_BLOCK });
return composite; |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | }
private Shell getShell() {
if (fSWTWidget != null) {
return fSWTWidget.getShell();
}
return JavaPlugin.getActiveWorkbenchShell();
}
/**
* Initializes the classpath for the given project. Multiple calls to init are allowed,
* but all existing settings will be cleared and replace by the given or default paths.
* @param project The java project to configure. Does not have to exist.
* @param outputLocation The output location to be set in the page. If <code>null</code>
* is passed, jdt default settings are used, or - if the project is an existing Java project - the
* output location of the existing project
* @param classpathEntries The classpath entries to be set in the page. If <code>null</code>
* is passed, jdt default settings are used, or - if the project is an existing Java project - the
* classpath entries of the existing project
*/
public void init(IJavaProject jproject, IPath outputLocation, IClasspathEntry[] classpathEntries) {
fCurrJProject= jproject;
boolean projExists= false;
try {
IProject project= fCurrJProject.getProject();
projExists= (project.exists() && project.hasNature(JavaCore.NATURE_ID));
if (projExists) {
if (outputLocation == null) {
outputLocation= fCurrJProject.getOutputLocation(); |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | }
if (classpathEntries == null) {
classpathEntries= fCurrJProject.getRawClasspath();
}
}
} catch (CoreException e) {
JavaPlugin.log(e.getStatus());
}
if (outputLocation == null) {
outputLocation= getDefaultBuildPath(jproject);
}
List newClassPath;
if (classpathEntries == null) {
newClassPath= getDefaultClassPath(jproject);
} else {
newClassPath= new ArrayList();
for (int i= 0; i < classpathEntries.length; i++) {
IClasspathEntry curr= classpathEntries[i];
int entryKind= curr.getEntryKind();
IPath path= curr.getPath();
boolean isExported= curr.isExported();
IResource res= null;
boolean isMissing= false;
if (entryKind != IClasspathEntry.CPE_VARIABLE) {
res= fWorkspaceRoot.findMember(path);
if (res == null) {
isMissing= (entryKind != IClasspathEntry.CPE_LIBRARY || !path.toFile().isFile()); |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | }
} else {
IPath resolvedPath= JavaCore.getResolvedVariablePath(path);
isMissing= (resolvedPath == null) || !resolvedPath.toFile().isFile();
}
CPListElement elem= new CPListElement(entryKind, path, res, curr.getSourceAttachmentPath(), curr.getSourceAttachmentRootPath(), isExported);
if (projExists) {
elem.setIsMissing(isMissing);
}
newClassPath.add(elem);
}
}
List exportedEntries = new ArrayList();
for (int i= 0; i < newClassPath.size(); i++) {
CPListElement curr= (CPListElement) newClassPath.get(i);
if (curr.isExported() || curr.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
exportedEntries.add(curr);
}
}
fBuildPathDialogField.setText(outputLocation.toString());
fClassPathList.setElements(newClassPath);
fClassPathList.setCheckedElements(exportedEntries);
if (fSourceContainerPage != null) {
fSourceContainerPage.init(fCurrJProject);
fProjectsPage.init(fCurrJProject);
fLibrariesPage.init(fCurrJProject);
} |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | doStatusLineUpdate();
}
/**
* Returns the Java project. Can return <code>null<code> if the page has not
* been initialized.
*/
public IJavaProject getJavaProject() {
return fCurrJProject;
}
/**
* Returns the current output location. Note that the path returned must not be valid.
*/
public IPath getOutputLocation() {
return new Path(fBuildPathDialogField.getText());
}
/**
* Returns the current class path (raw). Note that the entries returned must not be valid.
*/
public IClasspathEntry[] getRawClassPath() {
List elements= fClassPathList.getElements();
int nElements= elements.size();
IClasspathEntry[] entries= new IClasspathEntry[elements.size()];
for (int i= 0; i < nElements; i++) {
CPListElement currElement= (CPListElement) elements.get(i);
entries[i]= currElement.getClasspathEntry(); |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | }
return entries;
}
private List getDefaultClassPath(IJavaProject jproj) {
List list= new ArrayList();
IResource srcFolder;
if (JavaBasePreferencePage.useSrcAndBinFolders()) {
srcFolder= jproj.getProject().getFolder("src");
} else {
srcFolder= jproj.getProject();
}
list.add(new CPListElement(IClasspathEntry.CPE_SOURCE, srcFolder.getFullPath(), srcFolder));
IPath libPath= new Path(JavaRuntime.JRELIB_VARIABLE);
IPath attachPath= new Path(JavaRuntime.JRESRC_VARIABLE);
IPath attachRoot= new Path(JavaRuntime.JRESRCROOT_VARIABLE);
CPListElement elem= new CPListElement(IClasspathEntry.CPE_VARIABLE, libPath, null, attachPath, attachRoot, false);
list.add(elem);
return list;
}
private IPath getDefaultBuildPath(IJavaProject jproj) {
if (JavaBasePreferencePage.useSrcAndBinFolders()) {
return jproj.getProject().getFullPath().append("bin");
} else {
return jproj.getProject().getFullPath();
} |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | }
private class BuildPathAdapter implements IStringButtonAdapter, IDialogFieldListener {
public void changeControlPressed(DialogField field) {
buildPathChangeControlPressed(field);
}
public void dialogFieldChanged(DialogField field) {
buildPathDialogFieldChanged(field);
}
}
private void buildPathChangeControlPressed(DialogField field) {
if (field == fBuildPathDialogField) {
IContainer container= chooseContainer();
if (container != null) {
fBuildPathDialogField.setText(container.getFullPath().toString());
}
}
}
private void buildPathDialogFieldChanged(DialogField field) {
if (field == fClassPathList) {
updateClassPathStatus();
updateBuildPathStatus();
} else if (field == fBuildPathDialogField) {
updateBuildPathStatus();
} |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | doStatusLineUpdate();
}
private void doStatusLineUpdate() {
IStatus res= findMostSevereStatus();
fContext.statusChanged(res);
}
private IStatus findMostSevereStatus() {
return StatusUtil.getMoreSevere(fClassPathStatus, fBuildPathStatus);
}
/**
* Validates the build path.
*/
private void updateClassPathStatus() {
fClassPathStatus.setOK();
List elements= fClassPathList.getElements();
boolean entryMissing= false;
IClasspathEntry[] entries= new IClasspathEntry[elements.size()];
for (int i= elements.size()-1 ; i >= 0 ; i--) {
CPListElement currElement= (CPListElement)elements.get(i);
boolean isChecked= fClassPathList.isChecked(currElement);
if (currElement.getEntryKind() == IClasspathEntry.CPE_SOURCE) { |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | if (!isChecked) {
fClassPathList.setCheckedWithoutUpdate(currElement, true);
}
} else {
currElement.setExported(isChecked);
}
entries[i]= currElement.getClasspathEntry();
entryMissing= entryMissing || currElement.isMissing();
}
if (entryMissing) {
fClassPathStatus.setWarning(NewWizardMessages.getString("BuildPathsBlock.warning.EntryMissing"));
}
if (fCurrJProject.hasClasspathCycle(entries)) {
fClassPathStatus.setWarning(NewWizardMessages.getString("BuildPathsBlock.warning.CycleInClassPath"));
}
}
/**
* Validates output location & build path.
*/
private void updateBuildPathStatus() {
fOutputLocationPath= null;
String text= fBuildPathDialogField.getText();
if ("".equals(text)) {
fBuildPathStatus.setError(NewWizardMessages.getString("BuildPathsBlock.error.EnterBuildPath"));
return;
}
IPath path= new Path(text); |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | IResource res= fWorkspaceRoot.findMember(path);
if (res != null) {
if (res.getType() == IResource.FILE) {
fBuildPathStatus.setError(NewWizardMessages.getString("BuildPathsBlock.error.InvalidBuildPath"));
return;
}
} else {
IPath projPath= path.uptoSegment(1);
if (!projPath.equals(fCurrJProject.getProject().getFullPath())) {
IProject proj= (IProject)fWorkspaceRoot.findMember(projPath);
if (proj == null || !proj.isOpen()) {
fBuildPathStatus.setError(NewWizardMessages.getString("BuildPathsBlock.error.BuildPathProjNotExists"));
return;
}
}
}
fOutputLocationPath= path;
List elements= fClassPathList.getElements();
IClasspathEntry[] entries= new IClasspathEntry[elements.size()];
for (int i= elements.size()-1 ; i >= 0 ; i--) {
CPListElement currElement= (CPListElement)elements.get(i);
entries[i]= currElement.getClasspathEntry();
}
IStatus status= JavaConventions.validateClasspath(fCurrJProject, entries, path); |
3,471 | Bug 3471 Leading '/' in src page of Java wizard is misleading (1G842TH) | 1. create new java project "jp" with Create Java Project wizard. 2. in wizard goto second ("Source") page Observe: the Build Output Folder is "/jp/bin" Since this looks like a Unix pathname I interpret the leading "/" as an indication for a absolute pathname. Other tools use something like: {WORKBENCH}/jp/bin or shell variable syntax: $WORKBENCH/jp/bin NOTES: EG (1/30/01 10:34:33 AM) desktop is using the same convention for presenting paths. General issue: how to show a workbench relative path | resolved wontfix | d8eedf7 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-12T18:21:09Z" | "2001-10-11T03:13:20Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java | if (!status.isOK()) {
fBuildPathStatus.setError(status.getMessage());
return;
}
fBuildPathStatus.setOK();
}
/**
* Creates a runnable that sets the configured build paths.
*/
public IRunnableWithProgress getRunnable() {
final List classPathEntries= fClassPathList.getElements();
final IPath path= getOutputLocation();
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
if (monitor == null) {
monitor= new NullProgressMonitor();
}
monitor.beginTask(NewWizardMessages.getString("BuildPathsBlock.operationdesc"), 12);
try {
createJavaProject(classPathEntries, path, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
} |