Summary of Snap-In Scope Types
Global Scopes include the following types:
Namespace Scopes include the following types:
The following table shows which scopes can be selected (X) for each snap-in type. The scope classes are abbreviated in column headings as follows:
Table 2-2 Available Snap-in Types for Each Scope
The following topics describe each of the above snap-in scopes in more detail, including the available snap-in types for each scope class.
Dynamic, Menu, Namespace, Page, Result Modifier, Service, Status Bar, and Toolbar snap-ins can be registered with the GlobalScope scope. A snap-in registered with GlobalScope is active at all times (even when no objects have been selected in the object browser). This code registers a namespace snap-in using GlobalScope:
public RegistrationItem[] getRegistration()
{
GlobalScope scope;
scope = new GlobalScope(Shell.SNAPIN_NAMESPACE);
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
Dynamic, Menu, Popup Menu, Status Bar, and Toolbar snap-ins can be registered with the GlobalViewScope scope. A snap-in registered with GlobalViewScope becomes active when the user selects a view with the specified unique ID. The following code registers a toolbar item snap-in using GlobalViewScope:
public RegistrationItem[] getRegistration()
{
GlobalViewScope scope;
scope = new GlobalViewScope(Shell.SNAPIN_TOOLBARITEM,
"View UniqueID");
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
Dynamic, Menu, Popup Menu, Status Bar, and Toolbar snap-ins can be registered with the MultiSelectNamespaceBaseTypeScope scope, which defines a scope that is restricted to the namespace and object type specified at registration. The scope is also restricted to appear only when more than one object is selected and all objects have the same base ObjectType.
The base ObjectType is the ObjectType returned from ObjectEntry.getObjectType().
The subtypes returned from ObjectEntry.getSubTypes() do not apply here.
A snap-in registered with MultiSelectNamespaceBaseTypeScope becomes active when the user selects multiple objects of the specified type and in the namespace specified at registration. The following code registers a view snap-in using MultiSelectNamespaceBaseTypeScope:
public RegistrationItem[] getRegistration()
{
MultiSelectNamespaceBaseTypeScope scope;
scope = new MultiSelectNamespaceBaseTypeScope(Shell.SNAPIN_VIEW,
"Namespace UniqueID","Type");
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
Dynamic, Menu, Popup Menu, Status Bar, and Toolbar snap-ins can be registered with the MultiSelectNamespaceScope scope, which defines a scope that is restricted to the namespace specified at registration and which may appear only when more than one object is selected.
A snap-in registered with MultiSelectNamespaceScope becomes active when the user selects multiple objects in the namespace specified at registration. The following code registers a view snap-in using MultiSelectNamespaceScope:
public RegistrationItem[] getRegistration()
{
MultiSelectNamespaceScope scope;
scope = new MultiSelectNamespaceScope(Shell.SNAPIN_VIEW,
"Namespace UniqueID");
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
Dynamic, Menu, Page, Popup Menu, Status Bar, Toolbar, and View snap-ins can be registered with the NamespaceContainerTypesScope scope. A snap-in registered with NamespaceContainerTypesScope becomes active when the user selects a container object in the namespace specified at registration. The following code registers a page snap-in using NamespaceContainerTypesScope:
public RegistrationItem[] getRegistration()
{
NamespaceContainerTypesScope scope;
scope = new NamespaceContainerTypesScope(Shell.SNAPIN_PAGE,
"Namespace UniqueID");
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
Dynamic, Menu, Page, Popup Menu, Status Bar, Toolbar, and View snap-ins can be registered with the NamespaceLeafTypesScope scope. A snap-in registered with NamespaceLeafTypesScope becomes active when the user selects a leaf object in the namespace specified at registration. The following code registers a popup menu snap-in using NamespaceLeafTypesScope:
public RegistrationItem[] getRegistration()
{
NamespaceLeafTypesScope scope;
scope = new NamespaceLeafTypesScope(Shell.SNAPIN_POPUP_MENU,
"Namespace UniqueID");
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
Snap-ins of all types except Namespace and Service snap-ins can be registered with the NamespaceScope scope. A snap-in registered with NamespaceScope becomes active when the namespace specified at registration is selected. This code registers a view snap-in using NamespaceScope:
public RegistrationItem[] getRegistration()
{
NamespaceScope scope;
scope = new NamespaceScope(Shell.SNAPIN_VIEW,
"Namespace UniqueID");
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
View and Dynamic snap-ins can be registered with the NamespaceTreeObjectsScope scope. A snap-in registered with NamespaceTreeObjectsScope becomes active when the user selects a tree object in the namespace specified at registration. The following code registers a view snap-in using NamespaceTreeObjectsScope:
public RegistrationItem[] getRegistration()
{
NamespaceTreeObjectsScope scope;
scope = new NamespaceTreeObjectsScope(Shell.SNAPIN_VIEW,
"Namespace UniqueID");
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
All snap-ins except Namespace and Service snap-ins can be registered with the NamespaceTypeScope scope. A snap-in registered with NamespaceTypeScope becomes active when the user selects an object of the specified type and in the namespace specified at registration. The following code registers a view snap-in using NamespaceTypeScope:
public RegistrationItem[] getRegistration()
{
NamespaceTypeScope scope;
scope = new NamespaceTypeScope(Shell.SNAPIN_View,
"Namespace UniqueID", "Type");
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
Dynamic, Menu, Popup Menu, Status Bar, and Toolbar snap-ins can be registered with the NamespaceViewScope scope. A snap-in registered with NamespaceViewScope becomes active when the user selects a view in the namespace specified at registration. This code registers a toolbar snap-in using NamespaceViewScope:
public RegistrationItem[] getRegistration()
{
NamespaceViewScope scope;
scope = new NamespaceViewScope(Shell.SNAPIN_TOOLBARITEM,
"Namespace UniqueID", "View UniqueID");
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}
Dynamic and Page snap-ins may be registered with the Preference scope. A snap-in registered with PreferenceScope becomes active when the user selects Preferences from the Tools menu. The following code is an example of registering a page snap-in with the PreferenceScope:
public RegistrationItem[] getRegistration()
{
PreferenceScope scope = new PreferenceScope();
return new RegistrationItem[]
{
new RegistrationItem(scope, getClass().getName())
};
}