本文整理汇总了Java中org.netbeans.api.project.ProjectInformation.getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectInformation.getDisplayName方法的具体用法?Java ProjectInformation.getDisplayName怎么用?Java ProjectInformation.getDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.project.ProjectInformation
的用法示例。
在下文中一共展示了ProjectInformation.getDisplayName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPackageRootNode
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
private Node createPackageRootNode(FileObject rootFO, Project project, Filter filter) {
Node origNode;
try {
origNode = DataObject.find(rootFO).getNodeDelegate();
}
catch (DataObjectNotFoundException ex) {
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
return null;
}
String displayName;
Project owner = FileOwnerQuery.getOwner(rootFO);
if (owner != null) {
SourceGroup g = getSourceGroup(rootFO, owner);
displayName = g != null ? g.getDisplayName() : FileUtil.getFileDisplayName(rootFO);
if (project != owner) {
ProjectInformation pi = ProjectUtils.getInformation(owner);
displayName += " [" + pi.getDisplayName() + "]"; // NOI18N
}
}
else displayName = FileUtil.getFileDisplayName(rootFO);
return new FilteredNode(origNode, displayName, filter);
}
示例2: getListCellRendererComponent
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (" ".equals(value)) { // NOI18N
return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
File f = (File) value;
String message = f.getAbsolutePath();
if (projectConflict) {
Project p = FileOwnerQuery.getOwner(Utilities.toURI(f));
if (p!=null) {
ProjectInformation pi = ProjectUtils.getInformation(p);
String projectName = pi.getDisplayName();
message = MessageFormat.format (NbBundle.getMessage(SourceRootsUi.class,"TXT_RootOwnedByProject"), new Object[] {
message,
projectName});
}
}
return super.getListCellRendererComponent(list, message, index, isSelected, cellHasFocus);
}
示例3: getListCellRendererComponent
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
// #93658: GTK needs name to render cell renderer "natively"
setName("ComboBox.listRenderer"); // NOI18N
String text = null;
if (!(value instanceof Project)) {
text = value.toString();
} else {
ProjectInformation pi = ProjectUtils.getInformation((Project) value);
text = pi.getDisplayName();
setIcon(pi.getIcon());
}
setText(text);
if ( isSelected ) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
}
else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
return this;
}
示例4: actionPerformed
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
init();
for (ProteomicsProject project : lkpInfo.allInstances()) {
// use it somehow...
String propPath = project.getProjectPropertiesFile().getPath();
ProjectInformation info = ProjectUtils.getInformation(project);
String projName = info.getDisplayName();
StringBuilder sb = new StringBuilder();
sb.append("The prop file for project: ");
sb.append(projName);
sb.append("\n");
sb.append("Is at: ");
sb.append(propPath);
JOptionPane.showMessageDialog(null, sb.toString());
}
}
示例5: getDisplayName
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
@Override
public String getDisplayName() {
ProjectInformation info = getProjectInformation();
if (info != null) {
return info.getDisplayName();
} else {
return NbBundle.getMessage(ProjectNode.class, "TXT_UnknownProjectName");
}
}
示例6: initProjectInfo
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
private void initProjectInfo() {
Project p = FileOwnerQuery.getOwner(fileObject);
if (p != null) {
ProjectInformation pi = ProjectUtils.getInformation(p);
projectName = pi.getDisplayName();
projectIcon = pi.getIcon();
}
}
示例7: evaluate
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
@Override
public void evaluate(SearchRequest request, SearchResponse response) {
final String searchText = request.getText().toLowerCase();
for (final Project project : OpenProjects.getDefault().getOpenProjects()) {
final ProjectInformation info = ProjectUtils.getInformation(project);
if (info == null || info.getDisplayName() == null) {
continue;
}
final String projectName = info.getDisplayName();
final String projectNameLower = projectName.toLowerCase();
if (projectNameLower.contains(searchText)) {
final boolean result = response.addResult(new Runnable() {
@Override
public void run() {
//see http://forums.netbeans.org/post-140855.html#140855
ProjectUtilities.selectAndExpandProject(project);
ProjectUtilities.makeProjectTabVisible();
}
}, projectName);
if (!result) {
break;
}
}
}
}
示例8: getListCellRendererComponent
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
File f = (File) value;
String message = f.getAbsolutePath();
if (projectConflict) {
Project p = FileOwnerQuery.getOwner(Utilities.toURI(f));
if (p!=null) {
ProjectInformation pi = ProjectUtils.getInformation(p);
String projectName = pi.getDisplayName();
message = NbBundle.getMessage(SourceFoldersPanel.class,"TXT_RootOwnedByProject", message, projectName);
}
}
return super.getListCellRendererComponent(list, message, index, isSelected, cellHasFocus);
}
示例9: updateProjectProperties
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
private void updateProjectProperties(@NonNull final String newName) {
if (!updatedProps.isEmpty()) {
final ProjectInformation pi = ProjectUtils.getInformation(project);
final String oldName = pi.getDisplayName();
final EditableProperties ep = helper.getProperties (AntProjectHelper.PROJECT_PROPERTIES_PATH);
for (Map.Entry<String,Pair<String,Boolean>> e : updatedProps.entrySet()) {
final String propName = e.getKey();
final String format = e.getValue().first();
final boolean antName = e.getValue().second();
final String oldProp = MessageFormat.format(
format,
antName ?
PropertyUtils.getUsablePropertyName(oldName) :
oldName);
final String propValue = ep.getProperty(propName);
if (oldProp.equals (propValue)) {
final String newProp = MessageFormat.format(
format,
antName ?
PropertyUtils.getUsablePropertyName(newName) :
newName);
ep.put (propName, newProp);
}
}
helper.putProperties (AntProjectHelper.PROJECT_PROPERTIES_PATH,ep);
}
}
示例10: ProjectTreeElement
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
/** Creates a new instance of ProjectTreeElement */
public ProjectTreeElement(Project prj) {
ProjectInformation pi = ProjectUtils.getInformation(prj);
name = pi.getDisplayName();
icon = pi.getIcon();
this.prj = new WeakReference<Project>(prj);
prjDir = prj.getProjectDirectory();
}
示例11: getListCellRendererComponent
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value == null || value instanceof String) {
return super.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus);
}
ProjectInformation info = ProjectUtils.getInformation((Project) value);
JLabel label = (JLabel) super.getListCellRendererComponent(list, info.getDisplayName(), index, isSelected, cellHasFocus);
label.setIcon(info.getIcon());
return label;
}
示例12: initialize
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
@Override
public boolean initialize(Lookup context, AtomicBoolean cancel) {
FileObject file = context.lookup(FileObject.class);
Project selected = null;
if (file != null) {
selected = FileOwnerQuery.getOwner(file);
}
if (selected == null) {
selected = context.lookup(Project.class);
if (selected == null) {
SourceGroup sg = context.lookup(SourceGroup.class);
if (sg != null) {
selected = FileOwnerQuery.getOwner(sg.getRootFolder());
}
}
if (selected == null) {
DataFolder df = context.lookup(DataFolder.class);
if (df != null) {
selected = FileOwnerQuery.getOwner(df.getPrimaryFile());
}
}
}
if (selected == null || !OpenProjects.getDefault().isProjectOpen(selected)) {
return false;
}
ProjectInformation pi = ProjectUtils.getInformation(selected);
final SourceGroup[] sourceGroups = ProjectUtils.getSources(pi.getProject()).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
FileObject[] projectSources = new FileObject[sourceGroups.length];
for (int i = 0; i < sourceGroups.length; i++) {
projectSources[i] = sourceGroups[i].getRootFolder();
}
scope = Scope.create(Arrays.asList(projectSources), null, null);
detail = pi.getDisplayName();
icon = pi.getIcon();
return true;
}
示例13: getDisplayName
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
@Override
@NonNull
public String getDisplayName() {
final ProjectInformation d = delegate;
if (d != null) {
return d.getDisplayName();
} else {
String res = result.getDisplayName();
if (res == null) {
res = getName();
}
return res;
}
}
示例14: getProjectName
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
@Override
@NonNull
public String getProjectName() {
String res = projectName;
if (res == null) {
final ProjectInformation pi = getProjectInfo();
res = projectName = pi == null ?
"" : //NOI18N
pi.getDisplayName();
}
return res;
}
示例15: getDisplayName
import org.netbeans.api.project.ProjectInformation; //导入方法依赖的package包/类
private static String getDisplayName(FileObject fo, Project owner, boolean incPrjName) {
if (owner != null) {
SourceGroup grp = getSourceGroup(fo, owner);
String n = (grp!=null)?grp.getDisplayName():FileUtil.getFileDisplayName(fo);
if (incPrjName) {
ProjectInformation pi = ProjectUtils.getInformation(owner);
n += " [" + pi.getDisplayName() + "]";
}
return n;
} else
return FileUtil.getFileDisplayName(fo);
}