use of org.eclipse.ui.internal.navigator.NavigatorSafeRunnable in project polymap4-core by Polymap4.
the class LinkHelperDescriptor method createLinkHelper.
/**
* Create a link helper instance from this descriptors class attribute.
*
* @return An instance of the helper that is defined by the extension, or a
* Skeleton Link Helper.
*/
public ILinkHelper createLinkHelper() {
if (hasLinkHelperFailedCreation)
return SkeletonLinkHelper.INSTANCE;
final ILinkHelper[] helper = new ILinkHelper[1];
SafeRunner.run(new NavigatorSafeRunnable(configElement) {
public void run() throws Exception {
helper[0] = (ILinkHelper) configElement.createExecutableExtension(ATT_CLASS);
}
});
if (helper[0] != null)
return helper[0];
hasLinkHelperFailedCreation = true;
return SkeletonLinkHelper.INSTANCE;
}
use of org.eclipse.ui.internal.navigator.NavigatorSafeRunnable in project polymap4-core by Polymap4.
the class NavigatorActionService method getActionProviderInstance.
/**
* @param aProviderDescriptor
* @return a CommonActionProvider
* @noreference This method is not intended to be referenced by clients.
*/
public CommonActionProvider getActionProviderInstance(final CommonActionProviderDescriptor aProviderDescriptor) {
CommonActionProvider provider = null;
provider = (CommonActionProvider) actionProviderInstances.get(aProviderDescriptor);
if (provider != null) {
return provider;
}
synchronized (actionProviderInstances) {
provider = (CommonActionProvider) actionProviderInstances.get(aProviderDescriptor);
if (provider == null) {
final CommonActionProvider[] retProvider = new CommonActionProvider[1];
SafeRunner.run(new NavigatorSafeRunnable() {
public void run() throws Exception {
retProvider[0] = aProviderDescriptor.createActionProvider();
if (retProvider[0] != null) {
initialize(aProviderDescriptor.getId(), aProviderDescriptor.getPluginId(), retProvider[0]);
}
}
});
// This could happen in the exception case
if (retProvider[0] == null)
retProvider[0] = SkeletonActionProvider.INSTANCE;
actionProviderInstances.put(aProviderDescriptor, retProvider[0]);
provider = retProvider[0];
}
}
return provider;
}
use of org.eclipse.ui.internal.navigator.NavigatorSafeRunnable in project polymap4-core by Polymap4.
the class CommonActionProviderDescriptor method createActionProvider.
/**
* @return The instantiated CommonActionProvider for this descriptor as
* declared in the ATT_CLASS attribute or
* {@link SkeletonActionProvider} if a problem occurs while loading
* the instance.
*/
public CommonActionProvider createActionProvider() {
if (hasLoadingFailed) {
return SkeletonActionProvider.INSTANCE;
}
final CommonActionProvider[] provider = new CommonActionProvider[1];
SafeRunner.run(new NavigatorSafeRunnable(configurationElement) {
public void run() throws Exception {
provider[0] = (CommonActionProvider) configurationElement.createExecutableExtension(ATT_CLASS);
}
});
if (provider[0] != null)
return provider[0];
hasLoadingFailed = true;
return SkeletonActionProvider.INSTANCE;
}
use of org.eclipse.ui.internal.navigator.NavigatorSafeRunnable in project polymap4-core by Polymap4.
the class CommonDropAdapterDescriptor method createDropAssistant.
/**
* @return An instance of {@link CommonDropAdapterAssistant} from the
* descriptor or {@link SkeletonCommonDropAssistant}.
*/
public CommonDropAdapterAssistant createDropAssistant() {
final CommonDropAdapterAssistant[] retValue = new CommonDropAdapterAssistant[1];
SafeRunner.run(new NavigatorSafeRunnable(element) {
public void run() throws Exception {
retValue[0] = (CommonDropAdapterAssistant) element.createExecutableExtension(ATT_CLASS);
}
});
if (retValue[0] != null)
return retValue[0];
return SkeletonCommonDropAssistant.INSTANCE;
}
use of org.eclipse.ui.internal.navigator.NavigatorSafeRunnable in project polymap4-core by Polymap4.
the class CommonDropAdapter method performDrop.
public boolean performDrop(Object data) {
final DropTargetEvent event = getCurrentEvent();
if (Policy.DEBUG_DND) {
// $NON-NLS-1$
System.out.println("CommonDropAdapter.drop (begin): " + event);
}
final Object target = getCurrentTarget() != null ? getCurrentTarget() : getViewer().getInput();
// Must validate the drop here because on some platforms (Linux, Mac) the event
// is not populated with the correct currentDataType until the drop actually
// happens, and validateDrop sets the currentTransfer based on that. The
// call to validateDrop in dragAccept is too early.
validateDrop(target, getCurrentOperation(), event.currentDataType);
if (PluginTransfer.getInstance().isSupportedType(event.currentDataType)) {
super.drop(event);
return true;
}
if (Policy.DEBUG_DND) {
// $NON-NLS-1$ //$NON-NLS-2$
System.out.println("CommonDropAdapter.drop target: " + target + " op: " + getCurrentOperation());
}
final CommonDropAdapterAssistant[] assistants = dndService.findCommonDropAdapterAssistants(target, getCurrentTransfer());
final boolean[] retValue = new boolean[1];
for (int i = 0; i < assistants.length; i++) {
final CommonDropAdapterAssistant localAssistant = assistants[i];
SafeRunner.run(new NavigatorSafeRunnable() {
public void run() throws Exception {
localAssistant.setCurrentEvent(event);
IStatus valid = localAssistant.validateDrop(target, getCurrentOperation(), getCurrentTransfer());
if (valid != null && valid.isOK()) {
if (Policy.DEBUG_DND) {
System.out.println(// $NON-NLS-1$ //$NON-NLS-2$
"CommonDropAdapter.drop assistant selected: " + localAssistant + " op: " + event.detail);
}
localAssistant.handleDrop(CommonDropAdapter.this, event, target);
retValue[0] = true;
}
}
});
if (retValue[0])
return true;
}
return false;
}
Aggregations