use of org.netbeans.api.project.Project in project Aspose.BarCode-for-Java by aspose-barcode.
the class AsposeExampleWizardPanel method readSettings.
/**
* @param wiz
*/
@Override
public void readSettings(WizardDescriptor wiz) {
Project selectedProject = Templates.getProject(wiz);
File projdir = new File(selectedProject.getProjectDirectory().getPath());
wiz.putProperty("projdir", projdir);
AsposeMavenProjectManager asposeMavenProjectManager = AsposeMavenProjectManager.initialize(wiz);
AsposeBarCodeJavaAPI.initialize(asposeMavenProjectManager);
component.read();
}
use of org.netbeans.api.project.Project in project Aspose.Cells-for-Java by aspose-cells.
the class AsposeExampleWizardPanel method readSettings.
/**
* @param wiz
*/
@Override
public void readSettings(WizardDescriptor wiz) {
Project selectedProject = Templates.getProject(wiz);
File projdir = new File(selectedProject.getProjectDirectory().getPath());
wiz.putProperty("projdir", projdir);
AsposeMavenProjectManager asposeMavenProjectManager = AsposeMavenProjectManager.initialize(wiz);
AsposeCellsJavaAPI.initialize(asposeMavenProjectManager);
component.read();
}
use of org.netbeans.api.project.Project in project netbeans-mmd-plugin by raydac.
the class MMDDataObject method findProject.
public Project findProject() {
Project result = null;
final FileObject primary = this.getPrimaryFile();
if (primary != null) {
result = FileOwnerQuery.getOwner(primary);
}
return result;
}
use of org.netbeans.api.project.Project in project netbeans-mmd-plugin by raydac.
the class MMDGraphEditor method extractDataObjectOrFileFromDnD.
@Nullable
private Object extractDataObjectOrFileFromDnD(@Nonnull final DropTargetDropEvent dtde) throws Exception {
DataFlavor dataObjectFlavor = null;
DataFlavor nodeObjectFlavor = null;
DataFlavor projectObjectFlavor = null;
File detectedFileObject = null;
for (final DataFlavor df : dtde.getCurrentDataFlavors()) {
final Class<?> representation = df.getRepresentationClass();
if (Node.class.isAssignableFrom(representation)) {
nodeObjectFlavor = df;
break;
} else if (DataObject.class.isAssignableFrom(representation)) {
dataObjectFlavor = df;
break;
} else if (Project.class.isAssignableFrom(representation)) {
projectObjectFlavor = df;
break;
} else if (df.isFlavorJavaFileListType()) {
try {
final List list = (List) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
if (list != null && !list.isEmpty()) {
detectedFileObject = (File) list.get(0);
}
} catch (Exception ex) {
LOGGER.error("Can't extract file from DnD", ex);
throw ex;
}
}
}
DataObject dataObject;
if (nodeObjectFlavor != null) {
try {
final Node theNode = (Node) dtde.getTransferable().getTransferData(nodeObjectFlavor);
dataObject = theNode.getLookup().lookup(DataObject.class);
if (dataObject == null) {
final Project proj = theNode.getLookup().lookup(Project.class);
if (proj != null) {
dataObject = DataObject.find(proj.getProjectDirectory());
}
}
} catch (Exception ex) {
LOGGER.error("Can't extract node from dragged element", ex);
throw ex;
}
} else if (dataObjectFlavor != null) {
try {
dataObject = (DataObject) dtde.getTransferable().getTransferData(dataObjectFlavor);
} catch (Exception ex) {
LOGGER.error("Can't extract data object from dragged element", ex);
throw ex;
}
} else if (projectObjectFlavor != null) {
try {
dataObject = DataObject.find(((Project) dtde.getTransferable().getTransferData(projectObjectFlavor)).getProjectDirectory());
} catch (Exception ex) {
LOGGER.error("Can't extract data object from project", ex);
throw ex;
}
} else {
dataObject = null;
}
return dataObject == null ? detectedFileObject : dataObject;
}
use of org.netbeans.api.project.Project in project netbeans-mmd-plugin by raydac.
the class AbstractPlugin method _processFileObject.
private Problem _processFileObject(final Project project, int level, final FileObject fileObject) {
final Project theProject;
if (project == null) {
theProject = FileOwnerQuery.getOwner(fileObject);
} else {
theProject = project;
}
if (theProject == null) {
LOGGER.warn("Request process file object without a project as the owner : " + fileObject);
return null;
}
final FileObject projectDirectory = theProject.getProjectDirectory();
if (projectDirectory == null) {
LOGGER.warn("Request process file object in a project which doesn't have folder : " + fileObject + ", project : " + project);
return null;
}
final File projectFolder = FileUtil.toFile(projectDirectory);
Problem result = processFile(theProject, level, projectFolder, fileObject);
level++;
if (fileObject.isFolder()) {
for (final FileObject fo : fileObject.getChildren()) {
if (result != null) {
break;
}
if (fo.isFolder()) {
result = _processFileObject(theProject, level, fo);
} else {
result = processFile(theProject, level, projectFolder, fo);
}
}
}
return result;
}
Aggregations