* Contributors:
* VTT Technical Research Centre of Finland - initial API and implementation
* Semantum Oy - issue #4384
+ * Semantum Oy - issue #7737
*******************************************************************************/
package org.simantics.ui.workbench;
import org.simantics.db.Resource;
import org.simantics.db.Session;
import org.simantics.db.common.request.ParametrizedRead;
-import org.simantics.db.event.ChangeListener;
import org.simantics.db.management.ISessionContext;
import org.simantics.ui.SimanticsUI;
* </p>
*
* @author Tuukka Lehtonen
+ * @author Jani Simomaa
*/
public abstract class ResourceEditorPart extends EditorPart implements IResourceEditorPart {
Supplier<Boolean> disposedCallback = () -> disposed;
session.asyncRequest(
new TitleRequest(site.getId(), getResourceInput()),
- new TitleUpdater(site.getShell().getDisplay(), this::setPartName, disposedCallback));
+ new TitleUpdater(site.getShell().getDisplay(), this::safeSetPartName, disposedCallback));
session.asyncRequest(
new ToolTipRequest(site.getId(), getResourceInput()),
- new TitleUpdater(site.getShell().getDisplay(), this::setTitleToolTip, disposedCallback));
+ new TitleUpdater(site.getShell().getDisplay(), this::safeSetTitleToolTip, disposedCallback));
+ }
+ }
+
+ /**
+ * Safely sets part name for parts whose IEditorInput is not yet disposed (e.g.
+ * removed from database)
+ *
+ * @param partName
+ */
+ protected void safeSetPartName(String partName) {
+ if (!disposed) {
+ setPartName(partName);
+ }
+ }
+
+ /**
+ * Safely sets title tooltip for parts whose IEditorInput is not yet disposed (e.g.
+ * removed from database)
+ *
+ * @param toolTip
+ */
+ protected void safeSetTitleToolTip(String toolTip) {
+ if (!disposed) {
+ setTitleToolTip(toolTip);
}
}