本文整理汇总了Java中org.eclipse.ui.IPerspectiveRegistry类的典型用法代码示例。如果您正苦于以下问题:Java IPerspectiveRegistry类的具体用法?Java IPerspectiveRegistry怎么用?Java IPerspectiveRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPerspectiveRegistry类属于org.eclipse.ui包,在下文中一共展示了IPerspectiveRegistry类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addPerspectiveAndDescendants
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
/**
* Adds to the list all perspective IDs in the Workbench who's original ID
* matches the given ID.
*
* @param perspectiveIds
* the list of perspective IDs to supplement.
* @param id
* the id to query.
* @since 3.0
*/
@SuppressWarnings({ "unchecked" })
private static void addPerspectiveAndDescendants(List perspectiveIds,
String id) {
IPerspectiveRegistry registry = PlatformUI.getWorkbench()
.getPerspectiveRegistry();
IPerspectiveDescriptor[] perspectives = registry.getPerspectives();
for (int i = 0; i < perspectives.length; i++) {
// @issue illegal ref to workbench internal class;
// consider adding getOriginalId() as API on IPerspectiveDescriptor
PerspectiveDescriptor descriptor = ((PerspectiveDescriptor) perspectives[i]);
if (descriptor.getOriginalId().equals(id)) {
perspectiveIds.add(descriptor.getId());
}
}
}
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:26,代码来源:EnsembleBasicNewProjectResourceWizard.java
示例2: savePerspectiveToRegistryLegacy
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
@SuppressWarnings("restriction")
private IPerspectiveDescriptor savePerspectiveToRegistryLegacy(MPerspective perspective){
IPerspectiveRegistry perspectiveRegistry =
(PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry();
IPerspectiveDescriptor pd =
perspectiveRegistry.findPerspectiveWithId(perspective.getElementId());
if (pd == null) {
((PerspectiveRegistry) perspectiveRegistry).addPerspective(perspective);
pd = perspectiveRegistry.findPerspectiveWithId(perspective.getElementId());
} else {
LoggerFactory.getLogger(PerspektiveImportHandler.class)
.error("perspective descriptor already exists for perspective id: "
+ perspective.getElementId());
}
return pd;
}
开发者ID:elexis,项目名称:elexis-3-core,代码行数:18,代码来源:PerspektiveImportHandler.java
示例3: deletePerspective
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
@Override
public int deletePerspective(String perspectiveId){
IPerspectiveRegistry iPerspectiveRegistry =
PlatformUI.getWorkbench().getPerspectiveRegistry();
MApplication mApplication = getService(MApplication.class);
IPerspectiveDescriptor existingPerspectiveDescriptor =
iPerspectiveRegistry.findPerspectiveWithId(perspectiveId);
int idx = -1;
if (existingPerspectiveDescriptor != null) {
idx = closePerspective(existingPerspectiveDescriptor);
//NOT WORKING IF PERSPECTIVE IS PREDEFINED - workaround with generics
iPerspectiveRegistry.deletePerspective(existingPerspectiveDescriptor);
PerspectiveImportService.genericInvokMethod(iPerspectiveRegistry, "removeSnippet",
MSnippetContainer.class, String.class, mApplication,
existingPerspectiveDescriptor.getId());
}
return idx;
}
开发者ID:elexis,项目名称:elexis-3-core,代码行数:23,代码来源:PerspectiveImportService.java
示例4: fill
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
@Override
public void fill(ToolBar parent, int index) {
IPerspectiveRegistry pr = PlatformUI.getWorkbench().
getPerspectiveRegistry();
String cfg = CoreHub.localCfg.get(Preferences.CFG_PERSPEKTIVEN, "");
String[] ids = cfg.split(",");
if (cfg == "") return;
for (String id: ids) {
IPerspectiveDescriptor pd = pr.findPerspectiveWithId(id);
if (pd == null) continue;
ToolItem ti = new ToolItem(parent, SWT.PUSH);
ImageDescriptor idesc = pd.getImageDescriptor();
Image im = (idesc != null ? idesc.createImage() : null);
if (im != null)
ti.setImage(im);
else
ti.setText(pd.getLabel());
ti.setToolTipText(pd.getLabel());
ti.addSelectionListener(new TISelListener(pd.getId()));
}
parent.update();
}
开发者ID:elexis,项目名称:elexis-3-base,代码行数:27,代码来源:PerspektivenContribution.java
示例5: removeUnWantedPerspectives
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
/**
* Removes the unwanted perspectives from your RCP application
*/
public void removeUnWantedPerspectives() {
IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry();
IPerspectiveDescriptor[] perspectiveDescriptors = getAllRegisteredPerspectiveDescriptors();
ArrayList<IPerspectiveDescriptor> ignorePerspectiveList = getIgnorePerspectiveList(perspectiveDescriptors);
removePerspetives(perspectiveRegistry, ignorePerspectiveList);
}
开发者ID:capitalone,项目名称:Hydrograph,代码行数:10,代码来源:PerspectiveRemover.java
示例6: removePerspetives
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
private void removePerspetives(IPerspectiveRegistry perspectiveRegistry, List<IPerspectiveDescriptor> removePerspectiveDesc) {
// If the list is non-empty then remove all such perspectives from the IExtensionChangeHandler
if(perspectiveRegistry instanceof IExtensionChangeHandler && !removePerspectiveDesc.isEmpty()) {
IExtensionChangeHandler extChgHandler = (IExtensionChangeHandler) perspectiveRegistry;
extChgHandler.removeExtension(null, removePerspectiveDesc.toArray());
}
}
开发者ID:capitalone,项目名称:Hydrograph,代码行数:8,代码来源:PerspectiveRemover.java
示例7: addPerspectiveAndDescendants
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
/**
* Adds to the list all perspective IDs in the Workbench who's original ID
* matches the given ID.
*
* @param perspectiveIds
* the list of perspective IDs to supplement.
* @param id
* the id to query.
* @since 3.0
*/
private static void addPerspectiveAndDescendants(List perspectiveIds, String id) {
IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry();
IPerspectiveDescriptor[] perspectives = registry.getPerspectives();
for (int i = 0; i < perspectives.length; i++) {
// @issue illegal ref to workbench internal class;
// consider adding getOriginalId() as API on IPerspectiveDescriptor
PerspectiveDescriptor descriptor = ((PerspectiveDescriptor) perspectives[i]);
if (descriptor.getOriginalId().equals(id)) {
perspectiveIds.add(descriptor.getId());
}
}
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:23,代码来源:AbstractNewProjectWizard.java
示例8: switchToModelingPerspective
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
public static void switchToModelingPerspective(IWorkbenchWindow window) {
IPreferenceStore prefs = UIPluginActivator.getDefault()
.getPreferenceStore();
boolean hide = prefs.getBoolean(AUTO_SWITCH_PERSPECTIVE);
IWorkbenchPage page = window.getActivePage();
if (!hide) {
IWorkbench workbench = window.getWorkbench();
IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
IPerspectiveDescriptor descriptor = registry
.findPerspectiveWithId(IYakinduSctPerspectives.ID_PERSPECTIVE_SCT_MODELING);
if ((page != null) && (page.getPerspective() != descriptor)) {
MessageDialogWithToggle dialog = MessageDialogWithToggle
.openYesNoQuestion(
window.getShell(),
"Confirm Perspective Switch",
"This kind of editor is associated with the YAKINDU Modeling perspective. Do you want to switch to this perspective now?",
"Do not offer to switch perspective in the future",
hide, prefs, AUTO_SWITCH_PERSPECTIVE);
if (dialog.getReturnCode() == 2)
page.setPerspective(descriptor);
hide = dialog.getToggleState();
prefs.setValue(AUTO_SWITCH_PERSPECTIVE, hide);
try {
InstanceScope.INSTANCE.getNode(UIPluginActivator.PLUGIN_ID)
.flush();
} catch (BackingStoreException e) {
e.printStackTrace();
}
}
}
}
开发者ID:Yakindu,项目名称:statecharts,代码行数:32,代码来源:PerspectiveUtil.java
示例9: preLoadingPerspective
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
public static void preLoadingPerspective(String[] ids){
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page != null) {
IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry();
IPerspectiveDescriptor active = page.getPerspective();
for (int idx = ids.length - 1; idx >= 0; idx--) {
if (active == null || !active.getId().equals(ids[idx])) {
IPerspectiveDescriptor perspective = registry.findPerspectiveWithId(ids[idx]);
page.setPerspective(perspective);
}
}
page.setPerspective(active);
}
}
开发者ID:scouter-project,项目名称:scouter,代码行数:15,代码来源:RCPUtil.java
示例10: hidePerspectives
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
public static void hidePerspectives(String[] ids) {
IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry();
IPerspectiveDescriptor[] descriptors = registry.getPerspectives();
List ignoredPerspectives = Arrays.asList(ids);
List removePerspectiveDesc = new ArrayList();
for (IPerspectiveDescriptor desc : descriptors) {
if (ignoredPerspectives.contains(desc.getId())) {
removePerspectiveDesc.add(desc);
}
}
if (registry instanceof IExtensionChangeHandler && !removePerspectiveDesc.isEmpty()) {
IExtensionChangeHandler extChgHandler = (IExtensionChangeHandler) registry;
extChgHandler.removeExtension(null, removePerspectiveDesc.toArray());
}
}
开发者ID:scouter-project,项目名称:scouter,代码行数:16,代码来源:RCPUtil.java
示例11: printPerspectives
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
public static void printPerspectives(){
System.out.println("=== Perspectives ===");
IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry();
IPerspectiveDescriptor[] descriptors = registry.getPerspectives();
for (int idx = 0; idx < descriptors.length; idx++) {
System.out.println(descriptors[idx].getId());
}
}
开发者ID:scouter-project,项目名称:scouter,代码行数:9,代码来源:RCPUtil.java
示例12: showEmptyPerspective
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
public void showEmptyPerspective() {
final IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry();
final IPerspectiveDescriptor perspectiveDescriptor = perspectiveRegistry.findPerspectiveWithId(DynamicPerspective.ID);
final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
activePage.setPerspective(perspectiveDescriptor);
perspectiveRegistry.setDefaultPerspective(DynamicPerspective.ID);
}
开发者ID:jo-source,项目名称:jo-widgets,代码行数:8,代码来源:PartSupport.java
示例13: showPerspective
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
public void showPerspective(
final ComponentNodeContext componentTreeNodeContext,
final ComponentContext componentContext,
final ILayout perspective) {
if (perspective == null) {
showEmptyPerspective();
return;
}
final String perspectiveId = getPerspectiveId(perspective, componentTreeNodeContext);
final IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry();
IPerspectiveDescriptor newPerspective = perspectiveRegistry.findPerspectiveWithId(perspectiveId);
if (newPerspective == null) {
final IPerspectiveDescriptor perspectiveDescriptor = perspectiveRegistry.findPerspectiveWithId(DynamicPerspective.ID);
newPerspective = perspectiveRegistry.clonePerspective(
perspectiveId,
String.valueOf(perspective.getLabel()),
perspectiveDescriptor);
final IViewContainerContext context = registerViews(perspectiveId, perspective.getLayoutContainer(), componentContext);
viewContainerContextMap.put(perspectiveId, context);
}
final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
activePage.setPerspective(newPerspective);
// initialize views to update view titles from view model
initializeViews();
}
开发者ID:jo-source,项目名称:jo-widgets,代码行数:28,代码来源:PartSupport.java
示例14: getInitialWindowPerspectiveId
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
@Override
public String getInitialWindowPerspectiveId(){
String initPerspective = cod.getInitialPerspective();
// avoid that nothing opens up after login in case the stored perspective can't be found
IPerspectiveRegistry perspectiveRegistry =
PlatformUI.getWorkbench().getPerspectiveRegistry();
if (perspectiveRegistry.findPerspectiveWithId(initPerspective) == null) {
initPerspective = UiResourceConstants.PatientPerspektive_ID;
}
return initPerspective;
}
开发者ID:elexis,项目名称:elexis-3-core,代码行数:14,代码来源:ApplicationWorkbenchAdvisor.java
示例15: postWindowRestore
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
public void postWindowRestore() throws WorkbenchException
{
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
IWorkbenchWindow window = configurer.getWindow();
int index = getWorkbench().getWorkbenchWindowCount() - 1;
AboutInfo[] welcomePerspectiveInfos =
wbAdvisor.getWelcomePerspectiveInfos();
if (index >= 0 && welcomePerspectiveInfos != null
&& index < welcomePerspectiveInfos.length)
{
// find a page that exist in the window
IWorkbenchPage page = window.getActivePage();
if (page == null)
{
IWorkbenchPage[] pages = window.getPages();
if (pages != null && pages.length > 0)
{
page = pages[0];
}
}
// if the window does not contain a page, create one
String perspectiveId =
welcomePerspectiveInfos[index].getWelcomePerspectiveId();
if (page == null)
{
IAdaptable root = wbAdvisor.getDefaultPageInput();
page = window.openPage(perspectiveId, root);
}
else
{
IPerspectiveRegistry reg = getWorkbench().getPerspectiveRegistry();
IPerspectiveDescriptor desc = reg.findPerspectiveWithId(perspectiveId);
if (desc != null)
{
page.setPerspective(desc);
}
}
// set the active page and open the welcome editor
window.setActivePage(page);
page.openEditor(new WelcomeEditorInput(welcomePerspectiveInfos[index]),
WELCOME_EDITOR_ID, true);
}
cleanUpEditorArea();
}
开发者ID:debrief,项目名称:limpet,代码行数:49,代码来源:ApplicationWorkbenchWindowAdvisor.java
示例16: importPerspectiveFromStream
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
@SuppressWarnings("restriction")
private IPerspectiveDescriptor importPerspectiveFromStream(InputStream in, IStateCallback iStateHandle,
boolean openPerspectiveIfAdded) throws IOException{
MPerspective mPerspective = loadPerspectiveFromStream(in);
if (mPerspective != null) {
IPerspectiveRegistry iPerspectiveRegistry =
PlatformUI.getWorkbench().getPerspectiveRegistry();
// the perspective id to import
String id = mPerspective.getElementId();
IPerspectiveDescriptor existingPerspectiveDescriptor =
iPerspectiveRegistry.findPerspectiveWithId(id);
// the active perspective id
String activePerspectiveId = getActivePerspectiveId();
// check if the import should be done
if (existingPerspectiveDescriptor == null || iStateHandle == null
|| iStateHandle.state(State.OVERRIDE)) {
IPerspectiveDescriptor activePd =
iPerspectiveRegistry.findPerspectiveWithId(activePerspectiveId);
// delete if a perspective with the id already exists
int idx = deletePerspective(id);
// add the new perspective to the registry
((PerspectiveRegistry) iPerspectiveRegistry).addPerspective(mPerspective);
IPerspectiveDescriptor createdPd = iPerspectiveRegistry.findPerspectiveWithId(id);
if (createdPd != null) {
((PerspectiveDescriptor) createdPd).setHasCustomDefinition(false); //no original descriptor should exists
}
// check if the new perspective should be opened
if (idx > -1 || openPerspectiveIfAdded) {
openPerspective(createdPd);
// there was already an opened active perspective switch back to it
openPerspective(activePd);
}
return createdPd;
}
}
return null;
}
开发者ID:elexis,项目名称:elexis-3-core,代码行数:45,代码来源:PerspectiveImportService.java
示例17: isPerspectiveInStack
import org.eclipse.ui.IPerspectiveRegistry; //导入依赖的package包/类
public int isPerspectiveInStack(String perspectiveId){
IPerspectiveRegistry iPerspectiveRegistry =
PlatformUI.getWorkbench().getPerspectiveRegistry();
return isPerspectiveInsideStack(iPerspectiveRegistry.findPerspectiveWithId(perspectiveId));
}
开发者ID:elexis,项目名称:elexis-3-core,代码行数:6,代码来源:PerspectiveImportService.java
注:本文中的org.eclipse.ui.IPerspectiveRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论