Search in sources :

Example 1 with Project

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();
}
Also used : Project(org.netbeans.api.project.Project) AsposeMavenProjectManager(com.aspose.barcode.maven.utils.AsposeMavenProjectManager) File(java.io.File)

Example 2 with Project

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();
}
Also used : Project(org.netbeans.api.project.Project) AsposeMavenProjectManager(com.aspose.cells.maven.utils.AsposeMavenProjectManager) File(java.io.File)

Example 3 with Project

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;
}
Also used : Project(org.netbeans.api.project.Project) FileObject(org.openide.filesystems.FileObject)

Example 4 with Project

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;
}
Also used : Project(org.netbeans.api.project.Project) DataObject(org.openide.loaders.DataObject) Node(org.openide.nodes.Node) List(java.util.List) File(java.io.File) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) DataFlavor(java.awt.datatransfer.DataFlavor) Nullable(javax.annotation.Nullable)

Example 5 with Project

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;
}
Also used : Project(org.netbeans.api.project.Project) Problem(org.netbeans.modules.refactoring.api.Problem) FileObject(org.openide.filesystems.FileObject) File(java.io.File)

Aggregations

Project (org.netbeans.api.project.Project)16 FileObject (org.openide.filesystems.FileObject)6 File (java.io.File)5 ArrayList (java.util.ArrayList)3 Nullable (javax.annotation.Nullable)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 Problem (org.netbeans.modules.refactoring.api.Problem)2 DataObject (org.openide.loaders.DataObject)2 Node (org.openide.nodes.Node)2 PersistentArrayMap (clojure.lang.PersistentArrayMap)1 AsposeMavenProjectManager (com.aspose.barcode.maven.utils.AsposeMavenProjectManager)1 AsposeMavenProjectManager (com.aspose.cells.maven.utils.AsposeMavenProjectManager)1 DataFlavor (java.awt.datatransfer.DataFlavor)1 ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 Hashtable (java.util.Hashtable)1 Iterator (java.util.Iterator)1 List (java.util.List)1