Package org.openquark.cal.services

Examples of org.openquark.cal.services.Status


    /**
     * Handle the situation where the user has indicated that they would like to add a module from the Standard Vault to the current workspace.
     */
    private void handleAddModuleFromStandardVaultAction() {
        // Get the available modules not already in the workspace.   (The get avail modules operation shouldn't fail on the standard vault).
        Set<ModuleName> availableModulesSet = new HashSet<ModuleName>(Arrays.asList(StandardVault.getInstance().getAvailableModules(new Status("Add Status."))));
        availableModulesSet.removeAll(Arrays.asList(getWorkspace().getModuleNames()));
       
        // Convert to a String array.
        ModuleName[] availableModulesArray = availableModulesSet.toArray(new ModuleName[availableModulesSet.size()]);
        Arrays.sort(availableModulesArray);
View Full Code Here


     * @param revisionNumber
     * @param checkExisting if true, this operation will fail (with appropriate message) if the module already exists in the workspace.
     * If false, the added module will replace any existing module resources in the workspace.
     */
    private void handleAddModuleAttempt(Vault vault, ModuleName moduleName, int revisionNumber, boolean checkExisting) {
        Status addStatus = new Status("Add status");
       
        StoredVaultElement.Module moduleToAdd = vault.getStoredModule(moduleName, revisionNumber, addStatus);

        if (moduleToAdd == null) {
                       
            String title = getResourceString("AddModuleFailedTitle");
            String message;
            if (addStatus.getSeverity().compareTo(Status.Severity.ERROR) >= 0) {
                message = getResourceString("GetModuleErrorMessage") + addStatus.getDebugMessage();
            } else {
                message = getResourceString("AddModuleNotFoundMessage") + addStatus.getDebugMessage();
            }
            JOptionPane.showMessageDialog(GemCutter.this, message, title, JOptionPane.ERROR_MESSAGE);
            return;
        }
       
        Status addModuleStatus = new Status(getResourceString("AddModuleStatus"));
       
        if (!getWorkspace().addModule(moduleToAdd, checkExisting, addModuleStatus)) {
            String title = getResourceString("AddModuleFailedTitle");
           
            String message = getResourceString("AddModuleFailedMessage");
            String debugMessage = addModuleStatus.getDebugMessage();
            if (debugMessage != null) {
                message += "\n" + debugMessage;
            }
           
            JOptionPane.showMessageDialog(GemCutter.this, message, title, JOptionPane.ERROR_MESSAGE);
View Full Code Here

            String title = getResourceString("ExportModuleFailedDialogTitle");
            String message = getResourceString("GetModulesErrorMessage");
            JOptionPane.showMessageDialog(GemCutter.this, message, title, JOptionPane.ERROR_MESSAGE);
        }
       
        Status status = new Status("Put status.");
        int addedRevisionNum = enterpriseSupport.getEnterpriseVault().putStoredModule(selectedModuleName, getWorkspace(), status);
        if (status.getSeverity().compareTo(Status.Severity.ERROR) >= 0) {
            // Inform the user.
            showActionFailureDialog(getResourceString("ExportModuleFailedDialogTitle"),
                                    getResourceString("ExportModuleFailedDialogMessage") + "\n" + status.getDebugMessage(),
                                    null);
            return;

        } else if (status.getSeverity().compareTo(Status.Severity.WARNING) >= 0) {
            String title = getResourceString("ExportModuleWarningsDialogTitle");
            String message = getResourceString("ExportModuleWarningsDialogMessage") + status.getDebugMessage();
            JOptionPane.showMessageDialog(GemCutter.this, message, title, JOptionPane.ERROR_MESSAGE);
           
        }
       
        // Display a status message.
View Full Code Here

                    }
                }
            }
        }

        Status removeStatus = new Status("Remove status");
        getWorkspaceManager().removeModule(moduleToRemove, false, removeStatus);
       
        // update the perspective if the working module no longer exists (eg. because of compile failure..)
        if (perspective.getWorkingModule() == null) {
            ModuleName newWorkingModuleName = getInitialWorkingModuleName(workspaceManager.getWorkspace());
            if (newWorkingModuleName != null) {
                if (removingCurrentModule) {
                    changeModuleAndNewTableTop(newWorkingModuleName, true);
                } else {
                    perspective.setWorkingModule(newWorkingModuleName);                   
                }
            }

            // Change the current module if we just removed it.
            if (removingCurrentModule) {
                // clear the undo stack and dirty edit.
                extendedUndoManager.discardAllEdits();
                editToUndoWhenNonDirty = null;
                updateUndoWidgets();
            }
            // Also update the window title.
            updateWindowTitle();
        }

        // mark workspace as changed in Gem Browser
        getGemBrowser().markWorkspaceDirty()
       
        // Refresh the gem browser and navigator to show any new gems
        getGemBrowser().refresh();
        getNavigatorOwner().refresh();
       
        // Show any problems which were encountered during module resource removal.
        if (removeStatus.getSeverity().compareTo(Status.Severity.WARNING) >= 0 ) {
            String dialogTitle = getResourceString("RemoveModuleDialogTitle");
            String message = "Problems were encountered:\n"  + removeStatus.getDebugMessage();
            JOptionPane.showMessageDialog(GemCutter.this, message, dialogTitle, JOptionPane.WARNING_MESSAGE);
        }
    }
View Full Code Here

        // This may take a while, so set the cursor.
        Cursor oldCursor = getCursor();
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
       
        try {
            Status syncStatus = new Status(getResourceString("SyncWorkspaceStatus"));
            CALWorkspace workspace = getWorkspace();
            CALWorkspace.SyncInfo syncInfo = new CALWorkspace.SyncInfo();
           
            for (final ModuleName moduleName : moduleNames) {
                CALWorkspace.SyncInfo newSyncInfo = workspace.syncModuleToRevision(moduleName, -1, false, syncStatus);
View Full Code Here

    /**
     * Handle the situation where the user has indicated that they would like to sync the workspace to a declaration
     *   which is contained within an indicated vault.
     */
    private void handleSyncWorkspaceToDeclarationAttempt(Vault vault, String declarationName, int revisionNumber) {
        Status syncStatus = new Status(getResourceString("SyncWorkspaceStatus"));
       
        // Instantiate a provider.
        WorkspaceDeclaration.StreamProvider workspaceDeclarationProvider =
                new VaultWorkspaceDeclarationProvider(vault, declarationName, revisionNumber);

        // This may take a while, so set the cursor.
        Cursor oldCursor = getCursor();
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
       
        try {
            // Sync to the workspace declaration.
            CALWorkspace.SyncInfo syncInfo = getWorkspaceManager().syncWorkspaceToDeclaration(workspaceDeclarationProvider, syncStatus);
            if (syncInfo != null) {
                handleUserSyncPerformed(syncInfo, syncStatus);
            }
       
        } finally {
            // Reset the cursor.
            setCursor(oldCursor);
        }
       
        // Deal with errors.
        if (syncStatus.getSeverity().compareTo(Status.Severity.ERROR) >= 0) {
            String message = "Problems encountered while constructing the workspace:\n" + syncStatus.getDebugMessage();
            syncStatus.add(new Status(Status.Severity.ERROR, message, null));
        }
    }
View Full Code Here

     * @return an instance of this class for choosing modules, or null if the resources for the vault could not be obtained.
     */
    public static VaultResourceChooserDialog getModuleChooserDialog(Frame owner, String dialogTitle,
                                                                    String chooseActionMessage, Vault vault, ModuleName[] moduleNamesToExclude) {
       
        Status status = new Status("Vault status.");
        ModuleName[] availableModules = vault.getAvailableModules(status);
       
        if (moduleNamesToExclude != null && availableModules != null) {
            List<ModuleName> availableModulesList = new ArrayList<ModuleName>(Arrays.asList(availableModules));
            availableModulesList.removeAll(Arrays.asList(moduleNamesToExclude));
            availableModules = availableModulesList.toArray(new ModuleName[availableModulesList.size()]);
        }
       
        String[] availableModuleNameStrings = new String[availableModules.length];
        for (int i = 0; i < availableModules.length; i++) {
            availableModuleNameStrings[i] = availableModules[i].toSourceText();
        }

        if (availableModules == null || availableModules.length == 0) {
           
            if (status.getSeverity().compareTo(Status.Severity.WARNING) >= 0) {
                return null;

            } else {
                // There are simply no modules to choose.
                // This is ok..
View Full Code Here

     * @return an instance of this class for choosing modules, or null if the resources for the vault could not be obtained.
     */
    public static VaultResourceChooserDialog getWorkspaceDeclarationChooserDialog(Frame owner, String dialogTitle,
                                                                                  String chooseActionMessage, Vault vault) {
       
        Status status = new Status("Vault status.");
        String[] availableWorkspaceDeclarations = vault.getAvailableWorkspaceDeclarations(status);

        if (availableWorkspaceDeclarations == null || availableWorkspaceDeclarations.length == 0) {
           
            if (status.getSeverity().compareTo(Status.Severity.WARNING) >= 0) {
                return null;

            } else {
                // There are simply no workspace declarations to choose.
                // This is ok..
View Full Code Here

            gemCutter.getTableTop().loadXML((Element) tableTopNode, gemCutter.getPerspective(), loadStatus);
           
            // TODOEL: write a schema and validate against it

        } catch (BadXMLDocumentException bxde) {
            loadStatus.add(new Status(Status.Severity.ERROR, GemCutter.getResourceString("SOM_GCLoadFailure"), bxde));
        }
    }
View Full Code Here

       
        // Get the gem design.
        Document designDocument = XMLPersistenceHelper.getEmptyDocument();
        saveXML(designDocument);
       
        Status saveStatus = gemCutter.getWorkspace().saveEntity(gemName, gemDefinition, newGemMetadata, designDocument);
       
        if (saveStatus.getSeverity() != Status.Severity.ERROR) {
            // TEMP: this is a re-entrancy hack
            gemCutter.recompileWorkspace(true);
        }
       
        return saveStatus;
View Full Code Here

TOP

Related Classes of org.openquark.cal.services.Status

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.