📄 editorfactory.java
字号:
/*******************************************************************************
* Copyright (c) 2007 Siemens AG
*
* 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:
* Kai T鰀ter - initial API and implementation
*******************************************************************************/
package com.siemens.ct.mp3m.ui.views;
import java.util.ArrayList;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.IEditorPart;
import com.siemens.ct.mp3m.utilities.LogUtil;
public class EditorFactory {
static private IEditorPart defaultMp3Editor;
static private String defaultMp3EditorId;
static public IEditorPart[] getMp3Editors() {
IConfigurationElement[] editors = Platform.getExtensionRegistry()
.getConfigurationElementsFor("org.eclipse.ui", "editors");
ArrayList<IEditorPart> editorParts = new ArrayList<IEditorPart>();
for (IConfigurationElement editor : editors) {
try {
String extensions = editor.getAttribute("extensions");
if ("mp3".equals(extensions)) {
IEditorPart editorPart = (IEditorPart) editor
.createExecutableExtension("class");
editorParts.add(editorPart);
defaultMp3Editor = editorPart;
defaultMp3EditorId = editor.getAttribute("id");
}
} catch (CoreException e) {
LogUtil.logError("com.siemens.ct.mp3m.ui.views",e);
}
}
IEditorPart[] array = new IEditorPart[0];
return editorParts.toArray(array);
}
/**
* Gets the defaultMp3Editor.
*
* @return Returns the defaultMp3Editor.
*/
public static IEditorPart getDefaultMp3Editor() {
getMp3Editors();
return defaultMp3Editor;
}
/**
* Gets the defaultMp3EditorId.
*
* @return Returns the defaultMp3EditorId.
*/
public static String getDefaultMp3EditorId() {
getMp3Editors();
return defaultMp3EditorId;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -