Skip to content
Snippets Groups Projects
Commit 3e698571 authored by Simon Barner's avatar Simon Barner
Browse files

Update view only when it is raised. This will hide the performance problems of...

Update view only when it is raised. This will hide the performance problems of the view in the most typical configuration (where the annotation view is not visible)
refs 3145
parent 506464da
No related branches found
No related tags found
No related merge requests found
......@@ -37,8 +37,11 @@ import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IPartListener2;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.part.ViewPart;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.IAnnotationValueService;
......@@ -60,7 +63,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author barner
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: EE75EE9DA08E49EF36E644324B35D0B0
* @ConQAT.Rating YELLOW Hash: ABA34824715CBD59797ACBADB1163534
*/
public abstract class AnnotationViewPartBase extends ViewPart implements ISelectionListener,
IAnnotationViewPart {
......@@ -302,7 +305,53 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
/** {@inheritDoc} */
@Override
public void createPartControl(Composite parent) {
getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
final IWorkbenchPartSite site = getSite();
site.getWorkbenchWindow().getSelectionService().addSelectionListener(this);
site.getPage().addPartListener(new IPartListener2() {
@Override
public void partActivated(IWorkbenchPartReference partRef) {
// Nothing to do
}
@Override
public void partBroughtToTop(IWorkbenchPartReference partRef) {
// Nothing to do
}
@Override
public void partClosed(IWorkbenchPartReference partRef) {
// Nothing to do
}
@Override
public void partDeactivated(IWorkbenchPartReference partRef) {
// Nothing to do
}
@Override
public void partOpened(IWorkbenchPartReference partRef) {
// Nothing to do
}
@Override
public void partHidden(IWorkbenchPartReference partRef) {
if(partRef.getId().equals(IAnnotationViewPart.ANNOTATION_VIEW_ID)) {
setUpdateEnabled(false);
}
}
@Override
public void partVisible(IWorkbenchPartReference partRef) {
if(partRef.getId().equals(IAnnotationViewPart.ANNOTATION_VIEW_ID)) {
setUpdateEnabled(true);
}
}
@Override
public void partInputChanged(IWorkbenchPartReference partRef) {
// Nothing to do
}
});
}
/** {@inheritDoc} */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment