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

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


                    for ( File projectFile : selectedProjectFiles )
                    {
                        monitor.subTask( projectFile.getName() );
                        try
                        {
                            Project project = ProjectsImporter.getProject( new FileInputStream( projectFile ),
                                projectFile.getAbsolutePath() );
                            projectsHandler.addProject( project );
                        }
                        catch ( ProjectsImportException e )
                        {
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

    {
        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() );
//
//            // Reseting the Exception Thrown
//            exceptionThrown = null;
//
//            try
//            {
//                getContainer().run( false, false, new IRunnableWithProgress()
//                {
//                    public void run( IProgressMonitor monitor )
//                    {
//                        StudioProgressMonitor studioProgressMonitor = new StudioProgressMonitor( monitor );
//
//                        // Getting the correct SchemaConnector for this connection
//                        List<SchemaConnector> correctSchemaConnectors = getCorrectSchemaConnectors( project
//                            .getConnection(), studioProgressMonitor );
//
//                        // If no suitable SchemaConnector has been found, we display an
//                        // error message and return false;
//                        if ( correctSchemaConnectors.size() == 0 )
//                        {
//                            studioProgressMonitor.reportError(
//                                "No suitable SchemaConnector has been found for the choosen Directory Server.",
//                                new NoSuitableSchemaConnectorException() );
//                        }
//
//                        // 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( new StudioProgressMonitor( monitor ) );
//
//                        // Checking if an error has occured
//                        if ( studioProgressMonitor.errorsReported() )
//                        {
//                            exceptionThrown = studioProgressMonitor.getException();
//                            return;
//                        }
//                    }
//                } );
//            }
//            catch ( InvocationTargetException e )
//            {
//                // Nothing to do (it will never occur)
//            }
//            catch ( InterruptedException e )
//            {
//                // Nothing to do.
//            }
//
//            if ( exceptionThrown != null )
//            {
//                if ( exceptionThrown instanceof NoSuitableSchemaConnectorException )
//                // Special case for the 'NoSuitableSchemaConnectorException'
//                {
//                    PluginUtils.logError( "No suitable SchemaConnector has been found for the selected connection.",
//                        exceptionThrown );
//                    ViewUtils.displayErrorMessageBox( "Error", "An error occured when creating the project.\n"
//                        + "No suitable SchemaConnector has been found for the selected connection." );
//                }
//                else
//                // Standard case
//                {
//                    PluginUtils.logError( "An error occured when creating the project.", exceptionThrown );
//                    ViewUtils.displayErrorMessageBox( "Error", "An error occured when creating the project." );
//                }
//                return false;
//            }
//        }
//        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 void run()
    {
        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
        if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
        {
            Project project = ( ( ProjectWrapper ) selection.getFirstElement() ).getProject();
            RenameProjectDialog dialog = new RenameProjectDialog( project.getName() );
            if ( dialog.open() == Dialog.OK )
            {
                projectsHandler.renameProject( project, dialog.getNewName() );
            }
        }
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

            if ( messageBox.open() == SWT.YES )
            {
                for ( Iterator<?> iterator = selection.iterator(); iterator.hasNext(); )
                {
                    ProjectWrapper wrapper = ( ProjectWrapper ) iterator.next();
                    Project project = wrapper.getProject();

                    if ( project.getState() == ProjectState.OPEN )
                    {
                        // Closing the project before removing it.
                        projectsHandler.closeProject( project );
                    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
    public boolean performFinish()
    {
        Project project = new Project( ProjectType.OFFLINE, informationPage.getProjectName() );
//        final Project project = new Project( informationPage.getProjectType(), informationPage.getProjectName() );
//        if ( informationPage.getProjectType().equals( ProjectType.APACHE_DIRECTORY_SERVER ) )
//        {
//            Connection connection = connectionSelectionPage.getSelectedConnection();
//            project.setConnection( connection );
//            try
//            {
//                getContainer().run( true, true, new IRunnableWithProgress()
//                {
//                    public void run( IProgressMonitor monitor )
//                    {
//                        project.fetchOnlineSchema( new StudioProgressMonitor( monitor ) );
//                    }
//                } );
//            }
//            catch ( InvocationTargetException e )
//            {
//                // TODO Auto-generated catch block
//                e.printStackTrace();
//            }
//            catch ( InterruptedException e )
//            {
//                // TODO Auto-generated catch block
//                e.printStackTrace();
//            }
//        }
//        else if ( informationPage.getProjectType().equals( ProjectType.OFFLINE ) )
//        {
            String[] selectedSchemas = schemasSelectionPage.getSelectedSchemas();
            if ( selectedSchemas != null )
            {
                for ( String selectedSchema : selectedSchemas )
                {
                    Schema schema = PluginUtils.loadCoreSchema( selectedSchema );
                    if ( schema != null )
                    {
                        project.getSchemaHandler().addSchema( schema );
                    }
                }
            }
//        }

View Full Code Here

    /**
     * Initializes the UI Fields.
     */
    private void initFields()
    {
        Project project = Activator.getDefault().getProjectsHandler().getOpenProject();

        differencesWidget.setInput( DifferenceEngine.getDifferences( project.getSchemaBackup(), project
            .getSchemaHandler().getSchemas() ) );
    }
View Full Code Here

    /**
     * Initializes the state of the View.
     */
    private void initState()
    {
        Project project = Activator.getDefault().getProjectsHandler().getOpenProject();
        if ( project != null )
        {
            viewer.getTree().setEnabled( true );
            newSchema.setEnabled( true );
            newAttributeType.setEnabled( true );
View Full Code Here

     * @throws ProjectsImportException
     *      if an error occurs when importing the project
     */
    public static Project getProject( 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.