Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2012-03-20 15:54:44 +0000
committerDani Megert2012-03-20 15:54:44 +0000
commit644073577e7d6e269666e550c072522474e199e0 (patch)
tree21296550e1206846157df04ce345562723456e6a
parentdd1902fc4c4f7de13963119f8eba93da8117a46c (diff)
downloadeclipse.jdt.ui-644073577e7d6e269666e550c072522474e199e0.tar.gz
eclipse.jdt.ui-644073577e7d6e269666e550c072522474e199e0.tar.xz
eclipse.jdt.ui-644073577e7d6e269666e550c072522474e199e0.zip
Fixed bug 344552: Source tabs not cleared when project is closed
-rw-r--r--org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/AbstractInfoView.java21
-rw-r--r--org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java29
2 files changed, 24 insertions, 26 deletions
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/AbstractInfoView.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/AbstractInfoView.java
index 5b351d36b4..3a7f53eebd 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/AbstractInfoView.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/AbstractInfoView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -164,18 +164,18 @@ public abstract class AbstractInfoView extends ViewPart implements ISelectionLis
/**
* Computes the input for this view based on the given element.
- *
- * @param element the element from which to compute the input
- * @return the input or <code>null</code> if the input was not computed successfully
+ *
+ * @param element the element from which to compute the input, or <code>null</code>
+ * @return the input or <code>null</code> if the input was not computed successfully
*/
abstract protected Object computeInput(Object element);
/**
* Computes the input for this view based on the given elements
- *
+ *
* @param part the part that triggered the current element update, or <code>null</code>
* @param selection the new selection, or <code>null</code>
- * @param element the new java element that will be displayed
+ * @param element the new java element that will be displayed, or <code>null</code>
* @param monitor a progress monitor
* @return the input or <code>null</code> if the input was not computed successfully
* @since 3.4
@@ -618,13 +618,9 @@ public abstract class AbstractInfoView extends ViewPart implements ISelectionLis
return;
}
-
// The actual computation
final Object input= computeInput(part, selection, je, computeProgressMonitor);
- if (input == null)
- return;
-
- final String description= computeDescription(part, selection, je, computeProgressMonitor);
+ final String description= input != null ? computeDescription(part, selection, je, computeProgressMonitor) : ""; //$NON-NLS-1$
Shell shell= getSite().getShell();
if (shell.isDisposed())
@@ -685,8 +681,9 @@ public abstract class AbstractInfoView extends ViewPart implements ISelectionLis
fGotoInputAction.setEnabled(true);
IJavaElement inputElement= getInput();
+ String toolTip= inputElement != null ? JavaElementLabels.getElementLabel(inputElement, TOOLTIP_LABEL_FLAGS) : ""; //$NON-NLS-1$
setContentDescription(description);
- setTitleToolTip(JavaElementLabels.getElementLabel(inputElement, TOOLTIP_LABEL_FLAGS));
+ setTitleToolTip(toolTip);
}
}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java
index 53f3c3724a..7d4e6bf4d4 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -923,9 +923,8 @@ public class JavadocView extends AbstractInfoView {
*/
@Override
protected Object computeInput(Object input) {
- //TODO: never used?
if (getControl() == null || ! (input instanceof IJavaElement))
- return null;
+ return getInputForNull();
IWorkbenchPart part= null;
IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
@@ -957,7 +956,7 @@ public class JavadocView extends AbstractInfoView {
@Override
protected Object computeInput(IWorkbenchPart part, ISelection selection, IJavaElement input, IProgressMonitor monitor) {
if (getControl() == null || input == null)
- return null;
+ return getInputForNull();
String javadocHtml;
@@ -1155,18 +1154,20 @@ public class JavadocView extends AbstractInfoView {
}
}
- boolean flushContent= true;
- if (buffer.length() > 0 || flushContent) {
- HTMLPrinter.insertPageProlog(buffer, 0, null, fBackgroundColorRGB, fgStyleSheet);
- if (base != null) {
- int endHeadIdx= buffer.indexOf("</head>"); //$NON-NLS-1$
- buffer.insert(endHeadIdx, "\n<base href='" + base + "'>\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- HTMLPrinter.addPageEpilog(buffer);
- return buffer.toString();
+ HTMLPrinter.insertPageProlog(buffer, 0, null, fBackgroundColorRGB, fgStyleSheet);
+ if (base != null) {
+ int endHeadIdx= buffer.indexOf("</head>"); //$NON-NLS-1$
+ buffer.insert(endHeadIdx, "\n<base href='" + base + "'>\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ HTMLPrinter.addPageEpilog(buffer);
+ return buffer.toString();
+ }
- return null;
+ private String getInputForNull() {
+ StringBuffer buffer= new StringBuffer();
+ HTMLPrinter.insertPageProlog(buffer, 0, null, fBackgroundColorRGB, fgStyleSheet);
+ HTMLPrinter.addPageEpilog(buffer);
+ return buffer.toString();
}
/**

Back to the top