/******************************************************************************* * Copyright (c) 2007, 2010 Association for Decentralized Information Management * in Industry THTH ry. * 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 * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.selectionview; import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbenchSite; import org.simantics.browsing.ui.common.ErrorLogger; import org.simantics.db.common.procedure.adapter.ListenerSupport; import org.simantics.db.management.ISessionContext; /** * Override {@link #createControls(Composite, ISessionContext)} to create * controls for your own tab. * *
* This class implements {@link ListenerSupport} to help in dealing with graph * request listeners. * *
* This adapter has the following default implementations for IPropertyTab: *
false
by default and
* true
if {@link #setDisposed()} has been calledtrue
if tab was marked disposed, false
* if it was already marked disposed
*/
protected boolean setDisposed() {
return disposed.compareAndSet(false, true);
}
@Override
public boolean isDisposed() {
return disposed.get();
}
@Override
public ISelectionProvider getSelectionProvider() {
return null;
}
@Override
public void requestFocus() {
Control control = getControl();
if (control == null || control.isDisposed())
return;
control.setFocus();
}
@Override
public void exception(Throwable t) {
ErrorLogger.defaultLogError("PropertyTabAdapter received unexpected exception.", t);
}
}