本文整理汇总了Java中org.eclipse.ui.part.EditorPart类的典型用法代码示例。如果您正苦于以下问题:Java EditorPart类的具体用法?Java EditorPart怎么用?Java EditorPart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EditorPart类属于org.eclipse.ui.part包,在下文中一共展示了EditorPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTimelineActive
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
public static boolean isTimelineActive() {
IWorkbench workbench = Activator.getDefault().getWorkbench();
IEditorPart current = EditorPartUtils.getCurrent(workbench);
if (current instanceof EditorPart) {
IEditorPart activeEditor = current;
if (activeEditor instanceof MultiPageEditorPart) {
MultiPageEditorPart editor = (MultiPageEditorPart) current;
int activePage = editor.getActivePage();
if (activePage >= 0) {
IEditorPart[] subEditors = editor.findEditors(editor.getEditorInput());
if (activePage < subEditors.length) {
activeEditor = subEditors[activePage];
}
}
}
Object adapter = activeEditor.getAdapter(Timeline.class);
if (adapter != null) {
return true;
}
}
return false;
}
示例2: partActivated
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
@Override
public void partActivated(IWorkbenchPart part) {
if (part instanceof IEditorPart) {
if (((IEditorPart) part).getEditorInput() instanceof IFileEditorInput) {
IFile file = ((IFileEditorInput) ((EditorPart) part)
.getEditorInput()).getFile();
System.out
.println("\n====== LOCATION OF ACTIVE FILE IN EDITOR ======");
System.out.println(file.getLocation());
System.out
.println("===============================================");
MarkerHandler.getInstance().refreshMarker(file);
cc.setBaseVersion(file);
}
}
}
示例3: activateContext
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
public void activateContext(String featureExpression) {
if (!isPartActivated) {
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();
IWorkbenchPart part = page.getActivePart();
if (part instanceof IEditorPart) {
if (((IEditorPart) part).getEditorInput() instanceof IFileEditorInput) {
IFile file = ((IFileEditorInput) ((EditorPart) part)
.getEditorInput()).getFile();
System.out
.println("\n====== LOCATION OF ACTIVE FILE IN EDITOR ======");
System.out.println(file.getLocation());
System.out
.println("===============================================");
MarkerHandler.getInstance().refreshMarker(file);
setBaseVersion(file);
}
}
}
contextOperations.activateContext(featureExpression);
}
示例4: onLoad
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
public void onLoad(final JasperDesign jd, final EditorPart editor) {
if (!(editor instanceof JrxmlEditor))
return;
String prop = jd.getProperty(AExporter.PROP_SERVERURL);
if (prop == null)
return;
JrxmlEditor jEditor = (JrxmlEditor) editor;
JasperReportsConfiguration jConfig = jEditor.getJrContext(null);
JSSFileRepositoryService repService = jConfig.getFileRepositoryService();
List<RepositoryService> rservices = repService.getRepositoryServices();
List<RepositoryService> toDel = new ArrayList<RepositoryService>();
for (RepositoryService rs : rservices)
if (rs instanceof JRSRepositoryService) {
toDel.add(rs);
FileRepositoryService frs = ((JRSRepositoryService) rs).getFileRepositoryService();
if (frs != null)
toDel.add(frs);
}
rservices.removeAll(toDel);
rservices.add(new JRSRepositoryService(repService, jConfig));
}
示例5: partActivated
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
@Override
public void partActivated(IWorkbenchPart part) {
if (part instanceof EditorPart) {
EditorPart editorPart = (EditorPart) part;
if (editorPart.getEditorInput() instanceof URIEditorInput) {
URIEditorInput input = (URIEditorInput) editorPart.getEditorInput();
updateView(input.getURI());
if(txtMessage != null){
txtMessage.setEnabled(true);
}
} else {
if(txtMessage != null){
txtMessage.setEnabled(false);
}
txtMessagePool.setText("Message Pool");
}
}
}
示例6: getDesignerProjectForEditor
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
/**
* This method will get the DesignerProject for the current XPage and return it.
* @param compEditor
* @return
*/
private DesignerProject getDesignerProjectForEditor(CompositeEditor compEditor){
IWorkbenchPart part = super.getWorkBenchPart();
if(part instanceof EditorPart){
EditorPart editor = (EditorPart)part;
IEditorInput input = editor.getEditorInput();
if(input instanceof IFileEditorInput){
IFileEditorInput fileInput = (IFileEditorInput)input;
IFile xpageFile = fileInput.getFile();
if(null != xpageFile){
IProject project = xpageFile.getProject();
if(null != project){
DesignerProject designerProj = DesignerResource.getDesignerProject(project);
if(null != designerProj){
return designerProj;
}
}
}
}
}
return null;
}
示例7: loadEditor
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
private void loadEditor() throws PartInitException
{
try
{
IDatabaseDescriptor<?> descriptor = DatabasePlugin.getDescriptor(table.getName());
if (descriptor.getEditorID() != null)
{
IConfigurationElement[] elements = Platform.getExtensionRegistry().
getConfigurationElementsFor("org.eclipse.ui.editors");
for(IConfigurationElement conf : elements)
{
if (conf.getAttribute("id").equals(descriptor.getEditorID()))
{
Bundle plugin = Platform.getBundle(conf.getContributor().getName());
this.editorClass = (Class<EditorPart>) plugin.loadClass(conf.getAttribute("class"));
return;
}
}
}
}
catch (Exception e)
{
throwPartInitException(e);
}
}
示例8: partActivated
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
@Override
public void partActivated(IWorkbenchPart part) {
Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
IEditorReference[] editorReference= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
if(part instanceof EditorPart){
if(shell != null){
shell.setText(windowTitlePrefix+((EditorPart)part).getTitleToolTip()+windowTitleSuffix);
}
}else{
if(editorReference!=null && editorReference.length==0){
shell.setText(windowTitleDefault);
}
}
}
示例9: initRetargetActions
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
public void initRetargetActions(final EditorPart newEditor) {
final Iterator iter = getActionRegistry().getActions();
while (iter.hasNext()) {
final IAction action = (IAction) iter.next();
if (action instanceof RetargetAction) {
((RetargetAction) action).partActivated(newEditor);
}
}
}
示例10: initRetargetActions
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
public void initRetargetActions(EditorPart newEditor) {
Iterator iter = this.getActionRegistry().getActions();
while (iter.hasNext()) {
IAction action = (IAction) iter.next();
if (action instanceof RetargetAction) {
((RetargetAction) action).partActivated(newEditor);
}
}
}
示例11: ReportContainer
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
/**
* Instantiates a new report container.
*
* @param parent
* the parent
*/
public ReportContainer(EditorPart parent, JasperReportsConfiguration jrContext) {
this.parent = parent;
this.jrContext = jrContext;
this.selectionCache = new CommonSelectionCacheProvider();
//Store the selection cache
jrContext.put(SELECTION_CACHE_KEY, selectionCache);
}
示例12: EditorPartInputActivationListener
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
/**
* Creates this activation listener.
*
* @param editor the part service on which to add the part listener
* @since 3.1
*/
public EditorPartInputActivationListener(EditorPart editor) {
fEditor= editor;
fPartService= editor.getSite().getWorkbenchWindow().getPartService();
fPartService.addPartListener(this);
PlatformUI.getWorkbench().addWindowListener(this);
ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
}
示例13: propertyChanged
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
@Override
public void propertyChanged(Object source, int propId)
{
if (EditorPart.PROP_DIRTY == propId) {
setDirty(true);
}
}
示例14: propertyChanged
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
@Override
public void propertyChanged(Object source, int propId)
{
if (EditorPart.PROP_DIRTY == propId)
{
setDirty(true);
}
}
示例15: doSaveAs
import org.eclipse.ui.part.EditorPart; //导入依赖的package包/类
/**
*
* @see org.eclipse.ui.part.EditorPart#doSaveAs()
*/
public void doSaveAs() {
/* First, check if the tree has no structural errors. */
if (!checkTree()) {
StandardDialogs.errorDialog("Tree not saved",
"Errors were detected while validating the tree");
return;
}
SaveBTAsAction action = new SaveBTAsAction(this.tree, this.getEditorInput().getName());
try {
action.run();
if (action.getSelectedFile() != null) {
BTEditorInput editorInput = (BTEditorInput) getEditorInput();
editorInput.setTreeName(action.getSelectedFile());
this.dirty = false;
setIsFromFile(true);
/*
* If the tree comes from a guard, it must be dissociated from
* its original tree. From then on, this BTEditor will be
* managed as a normal BTEditor.
*/
if (isFromGuard()) {
dissociateFromParentTree();
}
setPartName(editorInput.getName());
firePropertyChange(EditorPart.PROP_DIRTY);
firePropertyChange(PROP_TITLE);
}
} catch (Exception e) {
StandardDialogs.exceptionDialog("Error saving the tree",
"There was an error when saving the tree", e);
}
}