1 11 package org.eclipse.ui.views.navigator; 12 13 import org.eclipse.core.resources.IProject; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.jface.dialogs.MessageDialog; 16 import org.eclipse.osgi.util.NLS; 17 import org.eclipse.ui.internal.views.navigator.ResourceNavigatorMessages; 18 import org.eclipse.ui.views.framelist.TreeFrame; 19 import org.eclipse.ui.views.framelist.TreeViewerFrameSource; 20 21 24 public class NavigatorFrameSource extends TreeViewerFrameSource { 25 26 private ResourceNavigator navigator; 27 28 33 public NavigatorFrameSource(ResourceNavigator navigator) { 34 super(navigator.getTreeViewer()); 35 this.navigator = navigator; 36 } 37 38 43 protected TreeFrame createFrame(Object input) { 44 TreeFrame frame = super.createFrame(input); 45 frame.setName(navigator.getFrameName(input)); 46 frame.setToolTipText(navigator.getFrameToolTipText(input)); 47 return frame; 48 } 49 50 53 protected void frameChanged(TreeFrame frame) { 54 IResource resource = (IResource) frame.getInput(); 55 IProject project = resource.getProject(); 56 57 if (project != null && project.isOpen() == false) { 58 MessageDialog 59 .openInformation( 60 navigator.getViewSite().getShell(), 61 ResourceNavigatorMessages.NavigatorFrameSource_closedProject_title, 62 NLS.bind(ResourceNavigatorMessages.NavigatorFrameSource_closedProject_message, project.getName())); 63 navigator.getFrameList().back(); 64 } else { 65 super.frameChanged(frame); 66 navigator.updateTitle(); 67 } 68 } 69 } 70 | Popular Tags |