Package org.apache.directory.studio.schemaeditor.model

Examples of org.apache.directory.studio.schemaeditor.model.Project


        }

        for ( Iterator<?> i = rootElement.elementIterator( PROJECT_TAG ); i.hasNext(); )
        {
            Element projectElement = ( Element ) i.next();
            Project project = new Project();
            readProject( projectElement, project, path );
            projects.add( project );
        }

        return projects.toArray( new Project[0] );
View Full Code Here


     */
    public Image getImage( Object element )
    {
        if ( element instanceof ProjectWrapper )
        {
            Project project = ( ( ProjectWrapper ) element ).getProject();
            ProjectType type = project.getType();
            switch ( type )
            {
                case OFFLINE:
                    ProjectState state = project.getState();
                    switch ( state )
                    {
                        case OPEN:
                            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
                                PluginConstants.IMG_PROJECT_OFFLINE ).createImage();
                        case CLOSED:
                            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
                                PluginConstants.IMG_PROJECT_OFFLINE_CLOSED ).createImage();
                    }
                case APACHE_DIRECTORY_SERVER:
                    ProjectState state2 = project.getState();
                    switch ( state2 )
                    {
                        case OPEN:
                            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
                                PluginConstants.IMG_PROJECT_ADS ).createImage();
View Full Code Here

                    for ( File projectFile : selectedProjectFiles )
                    {
                        monitor.subTask( projectFile.getName() );
                        try
                        {
                            Project project = ProjectsImporter.getProject( projectFile.getAbsolutePath() );
                            projectsHandler.addProject( project );
                        }
                        catch ( ProjectsImportException e )
                        {
                            PluginUtils.logError( "An error occured when importing project " + projectFile.getName()
View Full Code Here

     * @param project
     *      the project
     */
    public void openProject( Project project )
    {
        Project oldOpenProject = openProject;
        if ( oldOpenProject != null )
        {
            oldOpenProject.setState( ProjectState.CLOSED );
        }

        openProject = project;
        openProject.setState( ProjectState.OPEN );

View Full Code Here

     * @param project
     *      the project
     */
    public void closeProject( Project project )
    {
        Project oldOpenProject = openProject;
        if ( oldOpenProject.equals( project ) )
        {
            oldOpenProject.setState( ProjectState.CLOSED );
            openProject = null;
        }

        notifyOpenProjectChanged( oldOpenProject, openProject );
    }
View Full Code Here

            {
                StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();

                if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
                {
                    Project project = ( ( ProjectWrapper ) selection.getFirstElement() ).getProject();
                    if ( project.getState().equals( ProjectState.CLOSED ) )
                    {
                        projectsHandler.openProject( project );
                    }
                }
            }
View Full Code Here

        /*
         * List of created target schemas.
         */
        Map<String, Schema> targetSchemas = new HashMap<String, Schema>();

        Project targetProject = Activator.getDefault().getProjectsHandler().getOpenProject();

        // merge all source objects to the target project
        for ( Object sourceObject : sourceObjects )
        {
            if ( sourceObject instanceof Project )
            {
                Project sourceProject = ( Project ) sourceObject;
                for ( Schema sourceSchema : sourceProject.getSchemaHandler().getSchemas() )
                {
                    Schema targetSchema = getTargetSchema( sourceSchema.getProject(), targetProject, targetSchemas );
                    mergeSchema( sourceSchema, targetProject, targetSchema, processedObjects, errorMessages,
                        replaceUnknownSyntax, mergeDependencies, pullUpAttributes );
                }
View Full Code Here

    {
        String projectName = informationPage.getProjectName();
        ProjectType projectType = informationPage.getProjectType();

        // Creating the project
        final Project project = new Project( projectType, projectName );

        if ( projectType.equals( ProjectType.ONLINE ) )
        // Project is an "Online Project"
        {
            // Setting the connection to use
            project.setConnection( connectionSelectionPage.getSelectedConnection() );

            RunnableContextRunner.execute( new StudioConnectionRunnableWithProgress()
            {
                public void run( StudioProgressMonitor monitor )
                {
                    // Getting the correct SchemaConnector for this connection
                    List<SchemaConnector> correctSchemaConnectors = getCorrectSchemaConnectors(
                        project.getConnection(), monitor );

                    // If no suitable SchemaConnector has been found, we display an
                    // error message and return false;
                    if ( correctSchemaConnectors.size() == 0 )
                    {
                        monitor.reportError(
                            "No suitable SchemaConnector has been found for the choosen Directory Server.", //$NON-NLS-1$
                            new NoSuitableSchemaConnectorException() );
                    }

                    // Check if generic schema connector is included, then remove it to use a specific one
                    if ( correctSchemaConnectors.size() > 1 )
                    {
                        for ( SchemaConnector schemaConnector : correctSchemaConnectors )
                        {
                            if ( schemaConnector instanceof GenericSchemaConnector )
                            {
                                correctSchemaConnectors.remove( schemaConnector );
                                break;
                            }
                        }
                    }

                    // Getting the correct SchemaConnector
                    SchemaConnector correctSchemaConnector = null;
                    if ( correctSchemaConnectors.size() == 1 )
                    {
                        correctSchemaConnector = correctSchemaConnectors.get( 0 );
                    }
                    else
                    {
                        // TODO display a dialog in which the user can select the correct schema connector
                    }

                    project.setSchemaConnector( correctSchemaConnector );

                    // Fetching the Online Schema
                    project.fetchOnlineSchema( monitor );
                }


                public String getName()
                {
                    return Messages.getString( "NewProjectWizard.FetchingSchema" ); //$NON-NLS-1$;
                }


                public Object[] getLockedObjects()
                {
                    return null;
                }


                public String getErrorMessage()
                {
                    return Messages.getString( "NewProjectWizard.ErrorWhileFetchingSchema" ); //$NON-NLS-1$;
                }


                public Connection[] getConnections()
                {
                    return null;
                }

            }, getContainer(), true );
        }
        else if ( projectType.equals( ProjectType.OFFLINE ) )
        // Project is an "Offline Project"
        {
            // Getting the selected 'core' schemas
            String[] selectedSchemas = schemasSelectionPage.getSelectedSchemas();
            ServerTypeEnum serverType = schemasSelectionPage.getServerType();
            if ( ( selectedSchemas != null ) && ( serverType != null ) )
            {
                SchemaHandler schemaHandler = project.getSchemaHandler();
                for ( String selectedSchema : selectedSchemas )
                {
                    Schema schema = PluginUtils.loadCoreSchema( serverType, selectedSchema );
                    if ( schema != null )
                    {
View Full Code Here

    public boolean performFinish()
    {
        String[] selectedSchemas = page.getSelectedSchemas();;
        ServerTypeEnum serverType = page.getServerType();

        Project project = Activator.getDefault().getProjectsHandler().getOpenProject();
        if ( project != null )
        {
            if ( ( selectedSchemas != null ) && ( serverType != null ) )
            {
                SchemaHandler schemaHandler = project.getSchemaHandler();
                for ( String selectedSchema : selectedSchemas )
                {
                    Schema schema = PluginUtils.loadCoreSchema( serverType, selectedSchema );
                    if ( schema != null )
                    {
View Full Code Here

     * @throws ProjectsImportException
     *      if an error occurs when importing the project
     */
    public static Project getProject( InputStream inputStream, String path ) throws ProjectsImportException
    {
        Project project = new Project();

        SAXReader reader = new SAXReader();
        Document document = null;
        try
        {
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.schemaeditor.model.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.