当前位置: 首页>>代码示例>>Java>>正文


Java FileOwnerQuery.getOwner方法代码示例

本文整理汇总了Java中org.netbeans.api.project.FileOwnerQuery.getOwner方法的典型用法代码示例。如果您正苦于以下问题:Java FileOwnerQuery.getOwner方法的具体用法?Java FileOwnerQuery.getOwner怎么用?Java FileOwnerQuery.getOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.project.FileOwnerQuery的用法示例。


在下文中一共展示了FileOwnerQuery.getOwner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChatLink

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
public static String getChatLink(FileObject fo, int line) {
    ClassPath cp = ClassPath.getClassPath(fo, ClassPath.SOURCE);
    String ret = "";       // NOI18N
    if (cp != null) {
        ret = cp.getResourceName(fo);
    } else {
        Project p = FileOwnerQuery.getOwner(fo);
        if (p != null) {
            ret = "{$" +   // NOI18N
                    ProjectUtils.getInformation(p).getName() +
                   "}/" +  // NOI18N 
                   FileUtil.getRelativePath(p.getProjectDirectory(), fo);
            } else {
            ret = fo.getPath();
        }
    }
    ret += ":" + line;      // NOI18N
    ret =  "FILE:" + ret;   // NOI18N
    return ret;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:VCSKenaiAccessor.java

示例2: getEncoding

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
public Charset getEncoding(FileObject file) {
    if (isSystemFS(file)) {
        LOG.log(Level.FINER, "{0}: on system filesystem", file);    //NOI18N
        return null;
    }
    Project p = FileOwnerQuery.getOwner(file);
    if (p == null) {
        LOG.log(Level.FINER, "{0}: no owner", file);
        return null;
    }
    FileEncodingQueryImplementation delegate = p.getLookup().lookup(FileEncodingQueryImplementation.class);
    if (delegate == null) {
        if (LOG.isLoggable(Level.FINE)) {
            LOG.log(Level.FINE, "{0}: no FEQI in {1}", new Object[] {file, p});
        }
        return null;
    }
    Charset encoding = delegate.getEncoding(file);
    if (LOG.isLoggable(Level.FINE)) {
       LOG.log(Level.FINE, "{0}: got {1} from {2}", new Object[] {file, encoding, delegate});
    }
    return encoding;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ProjectFileEncodingQueryImplementation.java

示例3: PersistenceToolBarMVElement

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
/** Creates a new instance of DesignMultiViewElement */
public PersistenceToolBarMVElement(Lookup context) {
    super(context.lookup(PUDataObject.class));
    this.puDataObject=context.lookup(PUDataObject.class);
    this.project = FileOwnerQuery.getOwner(puDataObject.getPrimaryFile());
    addAction = new AddAction(NbBundle.getMessage(PersistenceToolBarMVElement.class,"LBL_Add"));
    removeAction = new RemoveAction(NbBundle.getMessage(PersistenceToolBarMVElement.class,"LBL_Remove"));
    
    comp = new ToolBarDesignEditor();
    factory=new PersistenceUnitPanelFactory(comp,puDataObject);
    setVisualEditor(comp);
    repaintingTask = RequestProcessor.getDefault().create(new Runnable() {
        @Override
        public void run() {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    repaintView();
                }
            });
        }
    });
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:PersistenceToolBarMVElement.java

示例4: enable

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
protected boolean enable(Node[] node) {
    if (node.length == 0) {
        return false;
    }
    DataObject dobj = (DataObject) node[0].getLookup().lookup(DataObject.class);
    if (dobj == null) {
        return false;
    }
    FileObject fo = dobj.getPrimaryFile();
    Project project = FileOwnerQuery.getOwner(fo);
    if(project == null)
        return false;
    Sources sources = ProjectUtils.getSources(project);
    SourceGroup[] srcGrps = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    if (srcGrps == null || srcGrps.length == 0) {
        return false;
    } else {
        return true;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:GenerateDOMScannerAction.java

示例5: enable

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
/**
 * Perform special enablement check in addition to the normal one.
 * 
 *     protected boolean enable (Node[] nodes) {
 *         if (!super.enable(nodes)) {
 *             return false;
 *         }
 *     }
 * 
 *     if (...) {
 *         ...
 *     }
 */
@Override
protected boolean enable(Node[] nodes) {
    if (nodes.length == 0) {
        return false;
    }
    
    for (Node node : nodes) {
        DataObject dataObj = node.getCookie(DataObject.class);
        if (dataObj != null) {
            FileObject fileObj = dataObj.getPrimaryFile();
            if ((fileObj == null) || !fileObj.isValid()) {
                continue;
            }
            
            Project prj = FileOwnerQuery.getOwner(fileObj);
            if ((prj == null) || (getSourceGroup(fileObj, prj) == null)) {
                continue;
            }

            if (JUnitTestUtil.isJavaFile(fileObj) 
                    || (node.getCookie(DataFolder.class) != null)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:TestAction.java

示例6: setUp

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
    clearWorkDir();
    MockLookup.setInstances(AntBasedTestUtil.testAntBasedProjectType(), TestUtil.testProjectFactory());
    final FileObject scratch = TestUtil.makeScratchDir(this);
    projDir = scratch.createFolder("proj"); //NOI18N
    srcDir = projDir.createFolder("src");   //NOI18N
    helper = ProjectGenerator.createProject(projDir, "test");
    eval = helper.getStandardPropertyEvaluator();
    project = FileOwnerQuery.getOwner(projDir);
    testRoots = new TestRoots(helper);
    testRoots.addRoot("src", srcDir, "Sources");
    src = QuerySupport.createSources(project, helper, eval, testRoots, Roots.nonSourceRoots("dist.dir"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:SourcesImplTest.java

示例7: removePaletteListener

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
public static synchronized void removePaletteListener(PropertyChangeListener listener,
                                                      FileObject context)
{
    Project project = FileOwnerQuery.getOwner(context);
    ProjectPaletteInfo pInfo = palettes.get(project);
    if (pInfo != null && pInfo.paletteListeners != null) {
        pInfo.paletteListeners.remove(listener);
        pInfo.getPalette().removePropertyChangeListener(listener);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:PaletteUtils.java

示例8: getSharability

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
@Override
public Sharability getSharability(URI uri) {
    Project p = FileOwnerQuery.getOwner(uri);
    if (p != null) {
        SharabilityQueryImplementation2 sqi = p.getLookup().lookup(SharabilityQueryImplementation2.class);
        if (sqi != null) {
            return sqi.getSharability(uri);
        }
    }
    return Sharability.UNKNOWN;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ProjectSharabilityQuery2.java

示例9: assertMessage

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
private String assertMessage(FileObject extensionXml) {
    try {
        return "Extension file:" + extensionXml.asText() + " is owned by " + FileOwnerQuery.getOwner(extensionXml) +
                " but should be " + implementation.getOwningProject();
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
        return ex.getMessage();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:AntBuildExtender.java

示例10: createContextAwareInstance

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
@Override
public Action createContextAwareInstance(Lookup actionContext) {
    NbMavenProjectImpl owner = null;
    List<FileObject> fs = new ArrayList<FileObject>();
    for (FileObject fo : actionContext.lookupAll(FileObject.class)) {
        Project p = FileOwnerQuery.getOwner(fo);
        if (p != null) {
            NbMavenProjectImpl own = p.getLookup().lookup(NbMavenProjectImpl.class);
            if (own != null) {
                if (owner != null) {
                    if (!owner.equals(own)) {
                        return this;
                    }
                } else {
                    owner = own;
                }
                fs.add(fo);
            } else if (owner != null) {
                return this;
            }
        } else if (owner != null) {
            return this;
        }
    }
    if (owner != null) {
        return new RunCustomMavenAction(action, owner, fs.toArray(new FileObject[0]));
    } else {
        return this;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:RunCustomMavenAction.java

示例11: configureProject

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
@NbBundle.Messages("remove_junit3_when_adding_testng=Removing JUnit 3.x dependency as TestNG has transitive dependency to JUnit 4.x.")
public void configureProject(FileObject createdFile) {
    ClassPath cp = ClassPath.getClassPath(createdFile, ClassPath.COMPILE);
    FileObject ng = cp.findResource("org.testng.annotations.Test"); //NOI18N
    if (ng == null) {
        final Project p = FileOwnerQuery.getOwner(createdFile);
        FileObject pom = p.getProjectDirectory().getFileObject("pom.xml"); //NOI18N
        ModelOperation<POMModel> operation = new ModelOperation<POMModel>() {
            public @Override
            void performOperation(POMModel model) {
                String groupID = "org.testng"; //NOI18N
                String artifactID = "testng"; //NOI18N
                if (!hasEffectiveDependency(groupID, artifactID, p.getLookup().lookup(NbMavenProject.class))) {
                    fixJUnitDependency(model, p.getLookup().lookup(NbMavenProject.class));
                    Dependency dep = ModelUtils.checkModelDependency(model, groupID, artifactID, true);
                    dep.setVersion("6.8.1"); //NOI18N
                    dep.setScope("test"); //NOI18N
                }
            }
        };
        Utilities.performPOMModelOperations(pom, Collections.singletonList(operation));
        RequestProcessor RP = new RequestProcessor("Configure TestNG project task", 1, true); //NOI18N
        RP.post(new Runnable() {

            public void run() {
                p.getLookup().lookup(NbMavenProject.class).downloadDependencyAndJavadocSource(true);
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:MavenTestNGSupport.java

示例12: contains

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
@Override public boolean contains(FileObject file) {
    if (file == loc) {
        return true;
    }
    String path = FileUtil.getRelativePath(loc, file);
    if (path == null) {
        return false;
    }
    if (file.isFolder()) {
        path += "/"; // NOI18N
    }
    if (!computeIncludeExcludePatterns().matches(path, true)) {
        return false;
    }
    Project p = getProject();
    if (file.isFolder() &&
            file != p.getProjectDirectory() &&
            ProjectManager.getDefault().isProject(file) &&
            !ProjectConvertors.isConvertorProject(FileOwnerQuery.getOwner(file))) {
        // #67450: avoid actually loading the nested project.
        return false;
    }
    if (!(SourceRoot.this instanceof TypedSourceRoot)) {
        // XXX disabled for typed source roots; difficult to make fast (#97215)
        Project owner = FileOwnerQuery.getOwner(file);
        if (owner != null &&
                owner != p &&
                !ProjectConvertors.isConvertorProject(owner)) {
            return false;
        }
        if (SharabilityQuery.getSharability(file) == SharabilityQuery.Sharability.NOT_SHARABLE) {
            return false;
        } // else MIXED, UNKNOWN, or SHARABLE
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:SourcesHelper.java

示例13: addPersistenceUnit

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
/**
 * Adds given persistence unit and schedules update of data.
 */
public void addPersistenceUnit(PersistenceUnit persistenceUnit){
    Project project = FileOwnerQuery.getOwner(getPrimaryFile());
    if(project != null) {
        ProviderUtil.makePortableIfPossible(project, persistenceUnit);
    }
    getPersistence().addPersistenceUnit(persistenceUnit);
    modelUpdated();
    firePropertyChange(PERSISTENCE_UNIT_ADDED_OR_REMOVED, false, true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:PUDataObject.java

示例14: getProject

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
private static Project getProject(URL url) {
    try {
        return FileOwnerQuery.getOwner(url.toURI());
    } catch (URISyntaxException ex) {
        Exceptions.printStackTrace(ex);
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ProjectServicesImpl.java

示例15: performAction

import org.netbeans.api.project.FileOwnerQuery; //导入方法依赖的package包/类
/** 
 * Actually performs the action. Implements superclass abstract method.
 * @param activatedNodes Currently activated nodes.
 */
protected void performAction(final Node[] activatedNodes) {
    if (activatedNodes.length != 1) {
        return;
    }

    final Node node = activatedNodes[0];
    DataObject dataObject = node.getCookie(DataObject.class);
    if (dataObject == null) {
        return;
    }

    if (FileOwnerQuery.getOwner(dataObject.getPrimaryFile()) == null) {
        return;
    }

    EditorCookie editorCookie = node.getCookie(EditorCookie.class);
    if (editorCookie == null) {
        editorCookie = dataObject.getCookie(EditorCookie.class);
        if (editorCookie == null) {
            return;
        }
    }

    editorCookie.open(); 
    I18nManager.getDefault().internationalize(dataObject);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:I18nAction.java


注:本文中的org.netbeans.api.project.FileOwnerQuery.getOwner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。