/** * Returns the unmodified title for the part, or the empty string if none * * @return the unmodified title, as set by the IWorkbenchPart. Returns the empty string if none. */ protected final String getRawTitle() { return Util.safeString(legacyPart.getTitle()); }
@Override public String getText(Object element) { if (element instanceof IWorkbenchPart) { IWorkbenchPart part = (IWorkbenchPart) element; String path = part.getTitleToolTip(); if (path == null || path.trim().length() == 0) { return part.getTitle(); } return part.getTitle() + " [" + path + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } if (element instanceof Saveable) { Saveable model = (Saveable) element; String path = model.getToolTipText(); if (path == null || path.trim().length() == 0) { return model.getName(); } return model.getName() + " [" + path + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } return null; }
Assert.isNotNull(part.getTitle(), "A part's title must be non-null"); //$NON-NLS-1$
private String getTitle(IWorkbenchPart part) { String title; if (part instanceof IWorkbenchPart2) { title = ((IWorkbenchPart2) part).getPartName(); } else { title = part.getTitle(); } // Null title is unexpected, but use an empty string if encountered. if (title == null) { title = ""; //$NON-NLS-1$ } return title; } }
public boolean supports(IWorkbenchPart editorPart) { return editorPart.getAdapter(Control.class) instanceof StyledText && (supportsFile(editorPart.getTitle()) || supportsFile(editorPart.getTitleToolTip())); }
@Override protected String getTableHeader(IWorkbenchPart activePart) { if (activePart instanceof WorkbenchPart) { return ((WorkbenchPart) activePart).getPartName(); } return activePart.getTitle(); }
@Override public String getName() { if (part instanceof IWorkbenchPart2) { return ((IWorkbenchPart2) part).getPartName(); } return part.getTitle(); }
@Override public String getTitle() { String title = legacyPart == null ? part.getLocalizedLabel() : legacyPart.getTitle(); return Util.safeString(title); }
@Override public String getContentDescription() { IWorkbenchPart workbenchPart = getPart(false); if (workbenchPart instanceof IWorkbenchPart2) { return ((IWorkbenchPart2) workbenchPart).getContentDescription(); } return workbenchPart.getTitle(); }
private void updateContentDescription() { if (isPinned() && currentPart != null) { setContentDescription(NLS.bind(PropertiesMessages.Selection_description, currentPart.getTitle())); } else { setContentDescription(""); //$NON-NLS-1$ } }
private String getSelectedResurcesButtonText() { int size = selectedResourcesFromContainer(fSearchDialog).size(); if (size == 1) { if (fSearchDialog.getActiveEditor() != null) return SearchMessages.ScopePart_selectedResourcesScope_text_editor; return NLS.bind(SearchMessages.ScopePart_selectedResourcesScope_text_singular, fSearchDialog.getWorkbenchWindow().getActivePage().getActivePart().getTitle()); } if (size > 1) return NLS.bind(SearchMessages.ScopePart_selectedResourcesScope_text_plural, Integer.valueOf(size), fSearchDialog.getWorkbenchWindow().getActivePage().getActivePart().getTitle()); return SearchMessages.ScopePart_selectedResourcesScope_text; }
private void updateContentDescription() { if (isPinned() && currentPart != null) { setContentDescription(NLS.bind(PropertiesMessages.Selection_description, currentPart.getTitle())); } else { setContentDescription(""); //$NON-NLS-1$ } // since our selection changes, our dirty state might change too firePropertyChange(IWorkbenchPartConstants.PROP_DIRTY); }
public void windowClosed(IWorkbenchWindow window) { if (fActiveEditor != null && fActiveEditor.getSite() != null && window == fActiveEditor.getSite().getWorkbenchWindow()) { if (DEBUG) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "closed active editor: " + fActiveEditor.getTitle()); //$NON-NLS-1$ //$NON-NLS-2$ activeJavaEditorChanged(null); } window.getPartService().removePartListener(this); }
private static String getPartId(IWorkbenchPart part) { if (part == null) { return "null part"; //$NON-NLS-1$ } return Util.safeString(part.getTitle()) + " - " //$NON-NLS-1$ + Util.safeString(part.getSite().getId()); }
@Override public void windowClosed(IWorkbenchWindow window) { if (fActiveEditor != null && fActiveEditor.getSite() != null && window == fActiveEditor.getSite().getWorkbenchWindow()) { if (JavaPlugin.DEBUG_AST_PROVIDER) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "closed active editor: " + fActiveEditor.getTitle()); //$NON-NLS-1$ //$NON-NLS-2$ activeJavaEditorChanged(null); } window.getPartService().removePartListener(this); }
@Override public void windowClosed(IWorkbenchWindow window) { if (fActiveEditor != null && fActiveEditor.getSite() != null && window == fActiveEditor.getSite().getWorkbenchWindow()) { if (JavaPlugin.DEBUG_AST_PROVIDER) System.out.println(CoreASTProvider.getThreadName() + " - " + CoreASTProvider.DEBUG_PREFIX + "closed active editor: " + fActiveEditor.getTitle()); //$NON-NLS-1$ //$NON-NLS-2$ activeJavaEditorChanged(null); } window.getPartService().removePartListener(this); }
private String computeLabel() { if (wrapped instanceof IWorkbenchPart2) { String label = ((IWorkbenchPart2) wrapped).getPartName(); return Util.safeString(label); } IWorkbenchPartSite site = wrapped.getSite(); if (site != null) { return Util.safeString(site.getRegisteredName()); } return Util.safeString(wrapped.getTitle()); }
/** * Calls a part listener with associated performance event instrumentation * * @param runnable * @param listener * @param part * @param description */ private void fireEvent(SafeRunnable runnable, IPartListener listener, IWorkbenchPart part, String description) { String label = null;//for debugging if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) { label = description + part.getTitle(); UIStats.start(UIStats.NOTIFY_PART_LISTENERS, label); } SafeRunner.run(runnable); if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) { UIStats.end(UIStats.NOTIFY_PART_LISTENERS, listener, label); } }
LegacyActionTools.escapeMnemonics(part.getTitle()));
/** * Constructor for CommonNavigatorTitleProvider. */ public TabbedPropertySheetTitleProvider() { super(); INavigatorContentService contentService = null; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPart part = window.getActivePage().findView(ProjectExplorer.VIEW_ID); if (part != null) { contentService = Adapters.adapt(part, INavigatorContentService.class); if (contentService != null) { labelProvider = contentService.createCommonLabelProvider(); descriptionProvider = contentService.createCommonDescriptionProvider(); } else { WorkbenchNavigatorPlugin.log( "Could not acquire INavigatorContentService from part (\"" + part.getTitle() + "\").", //$NON-NLS-1$ //$NON-NLS-2$ null); } } else { WorkbenchNavigatorPlugin.log("Could not acquire INavigatorContentService: Project Explorer not found.", //$NON-NLS-1$ null); } } else { WorkbenchNavigatorPlugin.log("Could not acquire INavigatorContentService: no active window.", null); //$NON-NLS-1$ } }