资源简介

完整的思维导图项目源码

资源截图

代码片段和文件信息

package org.xmind.cathy.internal;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.xmind.ui.mindmap.MindMapUI;

public class AbstractCheckFilesProcess {

    private final IWorkbench workbench;

    private List editorsToOpen;

    public AbstractCheckFilesProcess(IWorkbench workbench) {
        this.workbench = workbench;
    }

    public IWorkbench getWorkbench() {
        return workbench;
    }

    protected void addEditorToOpen(IEditorInput input) {
        if (editorsToOpen == null)
            editorsToOpen = new ArrayList();
        editorsToOpen.add(input);
    }

    protected void openEditors(boolean activate) {
        if (editorsToOpen != null && !editorsToOpen.isEmpty()) {
            openEditors(editorsToOpen activate);
        }
    }

    protected void openEditors(List editorInputs
            boolean activate) {
        for (final IEditorInput input : editorInputs) {
            IEditorPart editor = openEditor(input activate);
            if (editor != null)
                activate = false;
        }
    }

    protected IEditorPart openEditor(final IEditorInput input
            final boolean activate) {
        if (input == null)
            return null;

        Display display = workbench.getDisplay();
        if (display == null)
            return null;

        final IEditorPart[] result = new IEditorPart[1];
        display.syncExec(new Runnable() {
            public void run() {
                IWorkbenchWindow window = getPrimaryWindow();
                if (window == null)
                    return;
                final IWorkbenchPage page = window.getActivePage();
                if (page != null) {
                    SafeRunner.run(new SafeRunnable(NLS.bind(
                            WorkbenchMessages.CheckOpenFilesJob_FailsToOpen_message
                            input.getName())) {
                        public void run() throws Exception {
                            result[0] = page.openEditor(input
                                    MindMapUI.MINDMAP_EDITOR_ID activate);
                        }
                    });
                }
            }

        });
        return result[0];
    }

    private IWorkbenchWindow getPrimaryWindow() {
        IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
        if (window == null) {
            IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
            if (windows != null && windows.length > 0) {
                window = windows[0];
            }
        }
        return window;
    }

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-11-03 04:40  xmind-master\
     文件         385  2017-11-03 04:40  xmind-master\.gitignore
     文件        2996  2017-11-03 04:40  xmind-master\README.md
     目录           0  2017-11-03 04:40  xmind-master\bundles\
     目录           0  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\
     文件         168  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\.gitignore
     文件         488  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\.project
     目录           0  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\.settings\
     文件          55  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\.settings\org.eclipse.core.resources.prefs
     文件          50  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\.settings\org.eclipse.core.runtime.prefs
     目录           0  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\meta-INF\
     文件         179  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\meta-INF\MANIFEST.MF
     目录           0  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\OSGI-INF\
     目录           0  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\OSGI-INF\l10n\
     文件         110  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\OSGI-INF\l10n\bundle.properties
     文件         157  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\README
     文件         612  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\about.html
     文件          52  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\build.properties
     文件         693  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.fonts\pom.xml
     目录           0  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\
     文件         583  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\.classpath
     文件         168  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\.gitignore
     文件         682  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\.project
     目录           0  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\.settings\
     文件          55  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\.settings\org.eclipse.core.resources.prefs
     文件          50  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\.settings\org.eclipse.core.runtime.prefs
     文件       30184  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\.settings\org.eclipse.jdt.core.prefs
     文件        2723  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\.settings\org.eclipse.jdt.ui.prefs
     文件        1038  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\.settings\org.eclipse.pde.prefs
     目录           0  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\meta-INF\
     文件         476  2017-11-03 04:40  xmind-master\bundles\org.xmind.cathy.win32\meta-INF\MANIFEST.MF
............此处省略5749个文件信息

评论

共有 条评论