Java 类org.eclipse.ui.part.EditorPart 实例源码

项目:VariantSync    文件:PartAdapter.java   
@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);
        }
    }
}
项目:VariantSync    文件:ContextController.java   
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);
}
项目:PDFReporter-Studio    文件:JRSEditorContributor.java   
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));
}
项目:OpenSPIFe    文件:AbstractTimelineCommandHandler.java   
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;
}
项目:mondo-collab-framework    文件:WhiteboardGenericView.java   
@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");
        }
    }
}
项目:XPagesExtensionLibrary    文件:AbstractDesignElementPicker.java   
/**
 * 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;
}
项目:cuina    文件:DatabaseEditor.java   
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);
    }
}
项目:Hydrograph    文件:TitleBarPartListener.java   
@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);
        } 
    }
}
项目:ermasterr    文件:ERDiagramActionBarContributor.java   
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);
        }
    }
}
项目:ermaster-k    文件:ERDiagramActionBarContributor.java   
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);
        }
    }
}
项目:PDFReporter-Studio    文件:ReportContainer.java   
/**
 * 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);
}
项目:OpenSPIFe    文件:EditorPartInputActivationListener.java   
/**
 * 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);       
}
项目:ermaster-nhit    文件:ERDiagramActionBarContributor.java   
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);
        }
    }
}
项目:Environment    文件:ConfigAlternative.java   
@Override
public void propertyChanged(Object source, int propId)
{
    if (EditorPart.PROP_DIRTY == propId) {
        setDirty(true);
    }
}
项目:Environment    文件:InputAlternative.java   
@Override
public void propertyChanged(Object source, int propId)
{
    if (EditorPart.PROP_DIRTY == propId)
    {
        setDirty(true);
    }
}
项目:jbt    文件:BTEditor.java   
/**
 * 
 * @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);
    }
}
项目:convertigo-eclipse    文件:ConvertigoPartListener.java   
public void partOpened(IWorkbenchPart part) {
    if (part instanceof PropertySheet) {
        PropertySheet view = (PropertySheet)part;
        if (view != null) {
            if (view.getCurrentPage().getControl() instanceof Tree) {
                Tree tree = (Tree) view.getCurrentPage().getControl();
                if (tree != null) {
                    tree.addKeyListener(new KeyAdapter() {

                        @Override
                        public void keyReleased(KeyEvent event) {
                            boolean bCtrl = (((event.stateMask & SWT.CONTROL) != 0) || ((event.stateMask & SWT.CTRL) != 0));
                            int keyCode = event.keyCode;
                            char c = event.character;
                            if (bCtrl) {
                                if ((c == 's') || (keyCode == 115)) {
                                    ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
                                    if (projectExplorerView != null) {
                                        projectExplorerView.projectExplorerSaveAllAction.run();
                                    }
                                }
                            }
                        }

                    });
                }
            }
        }
    }
    if (part instanceof EditorPart) {
        IEditorInput input = ((EditorPart)part).getEditorInput();
        if (input instanceof ApplicationComponentEditorInput) {
            try {
                MobileBuilder mb = ((ApplicationComponentEditorInput)input).getApplication().getProject().getMobileBuilder();
                mb.addMobileEventListener((ApplicationComponentEditor)part);
                mb.setAutoBuild(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
项目:convertigo-eclipse    文件:ConnectorEditor.java   
public void setDirty(boolean dirty) {
    this.dirty = dirty;
    firePropertyChange(EditorPart.PROP_DIRTY);
}
项目:convertigo-eclipse    文件:SequenceEditor.java   
public void setDirty(boolean dirty) {
    this.dirty = dirty;
    firePropertyChange(EditorPart.PROP_DIRTY);
}
项目:team-explorer-everywhere    文件:BuildDeletedBrowserFunction.java   
public BuildDeletedBrowserFunction(final Browser browser, final String name, final EditorPart editor) {
    super(browser, name);
    this.editor = editor;
}
项目:team-explorer-everywhere    文件:WebAccessBaseEditor.java   
public static void closeEditor(final EditorPart editor) {
    final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    page.closeEditor(editor, false);
}
项目:PDFReporter-Studio    文件:ExtensionManager.java   
public void onLoad(JasperDesign jd, EditorPart editor) {
    for (IEditorContributor f : eContributor)
        f.onLoad(jd, editor);
}
项目:PDFReporter-Studio    文件:MultiOutlineView.java   
public MultiOutlineView(EditorPart editor) {
    getListeners();
    this.editor = editor;
}
项目:PDFReporter-Studio    文件:MultiOutlineView.java   
public EditorPart getEditor() {
    return editor;
}
项目:PDFReporter-Studio    文件:DeltaVisitor.java   
public DeltaVisitor(EditorPart part) {
    this.part = part;
}
项目:tesb-studio-se    文件:SaveAsRoutesAction.java   
public SaveAsRoutesAction(EditorPart editorPart) {
    this.editorPart = editorPart;
}
项目:jbt    文件:BTEditor.java   
/**
 * 
 * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
 */
public void doSave(IProgressMonitor monitor) {
    /* First, check if the tree has no structural errors. */
    if (!checkTree()) {
        StandardDialogs.errorDialog("Tree not saved",
                "Errors were detected while validating the tree");
        monitor.setCanceled(true);
        return;
    }

    /*
     * The save the tree.
     */
    try {
        if (this.isFromFile()) {
            /* If the tree comes from a file, save the tree into a file. */
            new SaveBTAction(this.tree, ((BTEditorInput) getEditorInput()).getTreeName()).run();
            this.dirty = false;
            firePropertyChange(EditorPart.PROP_DIRTY);
        } else if (this.isFromGuard()) {
            /*
             * If the tree comes from a guard, then set the tree as a guard
             * of the "this.guardNode". Note that we set a clone of the
             * guard, not the original one. By doing so, the guard of the
             * original node will not be modified even if this editor's tree
             * is modified.
             */
            BTNode guard = this.tree.getRoot().getChildren().get(0);
            if (guard != null) {
                this.guardNode.setGuard(guard.clone());
                this.guardTree.fireTreeChanged(this);
                BTEditorInput editorInput = (BTEditorInput) this.getEditorInput();
                Utilities.getBTEditor(Long.parseLong(editorInput.getTreeName().split(
                        File.pathSeparator)[0])).viewer.refresh();
            }
            this.dirty = false;
            firePropertyChange(EditorPart.PROP_DIRTY);
        } else {
            /* Otherwise, do a save as. */
            doSaveAs();
        }
    } catch (Exception e) {
        StandardDialogs.exceptionDialog("Tree not saved",
                "Errors were detected while saving the tree", e);
        monitor.setCanceled(true);
    }
}
项目:jbt    文件:BTEditor.java   
/**
 * 
 * @see jbt.tools.bteditor.event.ITreeModifierListener#treeModified(jbt.tools.bteditor.event.TreeModifiedEvent)
 */
public void treeModified(TreeModifiedEvent event) {
    this.dirty = true;
    firePropertyChange(EditorPart.PROP_DIRTY);
}
项目:jbt    文件:Utilities.java   
/**
 * Activates an editor.
 * 
 * @param editor
 *            the editor to activate.
 */
public static void activateEditor(EditorPart editor) {
    IWorkbenchPage page = editor.getSite().getPage();
    page.activate(editor);
}
项目:PDFReporter-Studio    文件:IEditorContributor.java   
public void onLoad(JasperDesign jd, EditorPart editor);