Example usage for org.eclipse.jface.dialogs IMessageProvider NONE

List of usage examples for org.eclipse.jface.dialogs IMessageProvider NONE

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider NONE.

Prototype

int NONE

To view the source code for org.eclipse.jface.dialogs IMessageProvider NONE.

Click Source Link

Document

Constant for a regular message (value 0).

Usage

From source file:org.eclipse.wst.server.ui.internal.wizard.fragment.DownloadableAdapterLicenseWizardFragment.java

License:Open Source License

public void enter() {
    super.enter();
    setForceLastFragment(true);/*from   w w  w.j  av  a2 s  . co m*/
    if (((Integer) getTaskModel().getObject(LicenseWizardFragment.LICENSE_ERROR))
            .equals(new Integer(IMessageProvider.ERROR))) {
        comp.setVisibleAcceptReject(false);
        wizardHandle.setTitle(Messages.errorTitle);
        wizardHandle.setMessage(Messages.chooseAnotherServer, IMessageProvider.ERROR);
    } else {
        comp.setVisibleAcceptReject(true);
        wizardHandle.setTitle(Messages.wizLicenseTitle);
        wizardHandle.setMessage("", IMessageProvider.NONE);
    }

}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.ModifyModulesComposite.java

License:Open Source License

protected void setEnablement() {
    wizard.setMessage(null, IMessageProvider.NONE);

    int count = 0;
    if (requiredModules != null) {
        // count how many of requiredModules are deployed
        int size = requiredModules.length;
        for (int i = 0; i < size; i++) {
            if (deployed.contains(requiredModules[i]))
                count++;//from   w w w  . j ava2s . c o  m
        }
    }

    // give error if there are more than one possible required modules and none are
    // added to the server
    isComplete = true;
    if (requiredModules != null && requiredModules.length > 1 && count == 0) {
        String s = "";
        int size = requiredModules.length;
        for (int i = 0; i < size; i++) {
            if (i > 0)
                s += " | ";
            s += requiredModules[i].getName();
        }
        wizard.setMessage(NLS.bind(Messages.wizModuleRequiredModules, s), IMessageProvider.ERROR);
        isComplete = false;
    }

    // selection specific messages
    ModuleServer[] ms = getAvailableSelection();
    if (ms == null || ms.length == 0) {
        add.setEnabled(false);
    } else {
        boolean enabled = false;
        // iterate through selection, if we find at least ONE module that can't be added, exit the loop
        for (int i = 0; i < ms.length; i++) {
            IModule module = getModule(ms[i]);
            if (module != null) {
                try {
                    IStatus status = errorMap.get(module);
                    if (modules.contains(module)) {
                        if (status == null)
                            enabled = true;
                        else if (status.getSeverity() == IStatus.ERROR) {
                            // this module can't be added because has errors, exit the loop
                            enabled = false;
                            wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
                            break;
                        } else if (status.getSeverity() == IStatus.WARNING) {
                            enabled = true;
                            wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
                        } else if (status.getSeverity() == IStatus.INFO) {
                            enabled = true;
                            wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
                        }
                    } else {
                        // at least ONE module from the selection can't be added, exit the loop   
                        enabled = false;
                        break;
                    }
                } catch (Exception e) {
                    if (Trace.INFO) {
                        Trace.trace(Trace.STRING_INFO, "Unable to handle error map for module:" + module);
                    }
                }
            }
        }
        add.setEnabled(enabled);
    }
    addAll.setEnabled(modules.size() > 0);

    ms = getDeployedSelection();
    if (ms == null || ms.length == 0) {
        remove.setEnabled(false);
    } else {
        boolean enabled = false;
        // iterate through selection, if we find at least ONE module that can't be removed, exit the loop
        for (int i = 0; i < ms.length; i++) {
            IModule module = getModule(ms[i]);
            if (module != null && deployed.contains(module)) {
                // provide error about removing required single module
                // required modules can't be removed
                if (requiredModules != null) {
                    if (requiredModules.length == 1 && requiredModules[0].equals(module)) {
                        // this is a required module and can't be removed, exit the loop
                        wizard.setMessage(NLS.bind(Messages.wizModuleRequiredModule, module.getName()),
                                IMessageProvider.ERROR);
                        enabled = false;
                        break;
                    }
                    enabled = true;
                } else if (errorMap.containsKey(module)) {
                    // this is a required module and can't be removed, exit the loop
                    wizard.setMessage(errorMap.get(module).getMessage(), IMessageProvider.ERROR);
                    enabled = false;
                    break;
                } else
                    enabled = true;
            } else {
                // this module is not found in the 'deployed' array, the module might be a child
                // at least ONE module from the selection can't be removed, exit the loop
                enabled = false;
                break;
            }
        }
        remove.setEnabled(enabled);
    }

    if (requiredModules == null)
        removeAll.setEnabled(deployed.size() > 0);
    else
        removeAll.setEnabled(deployed.size() > 1);
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewManualServerComposite.java

License:Open Source License

protected void handleHostnameChange(IServerType serverType) {

    wizard.setMessage(null, IMessageProvider.NONE);
    if (!validate(serverType)) {
        return;// Host name validation failed, so there is no need to continue handling hostname change event         
    }/*from   w  w  w  .  ja  va  2  s.c om*/
    loadServerImpl(serverType);

    if (serverName != null && !serverNameModified) {
        updatingServerName = true;
        if (server == null)
            serverName.setText("");
        else
            serverName.setText(server.getName());
        updatingServerName = false;
    }

    updateRuntimeCombo(serverType);
    if (serverName != null) {
        if (server == null) {
            serverName.setEditable(false);
            serverNameToolBar.getControl().setVisible(false);
        } else {
            serverName.setEditable(true);
            serverNameToolBar.getControl().setVisible(serverNameModified);
        }
    }
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewManualServerComposite.java

License:Open Source License

protected boolean validate(IServerType selectedServerType) {
    wizard.setMessage(null, IMessageProvider.NONE);
    return (checkHostAndServerType(selectedServerType) & checkServerName());
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewManualServerComposite.java

License:Open Source License

protected void setRuntime(IRuntime runtime2) {
    runtime = runtime2;/* w  ww . j  a v  a2  s. c o  m*/
    if (server != null) {
        server.setRuntime(runtime);
        ((ServerWorkingCopy) server).setDefaults(null);
        if (!serverNameModified) {
            updatingServerName = true;
            serverName.setText(server.getName());
            updatingServerName = false;
        } else {
            server.setName(serverName.getText());
        }
        // Validate if selected module is supported with the selected runtime
        wizard.setMessage(null, IMessageProvider.NONE);
        if (module != null) {
            canSupportModule = true;
            IStatus status = NewServerComposite.isSupportedModule(server, module);
            if (status != null) {
                if (status.getSeverity() == IStatus.ERROR) {
                    wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
                    canSupportModule = false;
                } else if (status.getSeverity() == IStatus.WARNING)
                    wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
                else if (status.getSeverity() == IStatus.INFO)
                    wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
            }
        }
    }
    listener.runtimeSelected(runtime);

}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewManualServerComposite.java

License:Open Source License

/**
 * Handle the server type selection./*from  w  w  w . j av a  2  s. c  o m*/
 */
protected void handleTypeSelection(IServerType serverType) {
    boolean wrong = false;
    if (serverType != null && moduleType != null) {
        IRuntimeType runtimeType = serverType.getRuntimeType();
        if (!ServerUtil.isSupportedModule(runtimeType.getModuleTypes(), moduleType)) {
            serverType = null;
            wrong = true;
            //wizard.setMessage("Not the right spec level2", IMessageProvider.ERROR);
        }
    }

    if (wrong) {
        server = null;
        runtime = null;
        wizard.setMessage(
                NLS.bind(Messages.errorVersionLevel,
                        new Object[] { moduleType.getName(), moduleType.getVersion() }),
                IMessageProvider.ERROR);
    } else if (serverType == null) {
        server = null;
        runtime = null;
        wizard.setMessage("", IMessageProvider.ERROR); //$NON-NLS-1$
    } else {
        wizard.setMessage(null, IMessageProvider.NONE);
        loadServerImpl(serverType);
        if (server != null && module != null) {
            IStatus status = NewServerComposite.isSupportedModule(server, module);
            if (status != null) {
                if (status.getSeverity() == IStatus.ERROR)
                    wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
                else if (status.getSeverity() == IStatus.WARNING)
                    wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
                else if (status.getSeverity() == IStatus.INFO)
                    wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
            }
        }
    }

    if (serverName != null && !serverNameModified) {
        updatingServerName = true;
        if (server == null)
            serverName.setText("");
        else
            serverName.setText(server.getName());
        updatingServerName = false;
    }

    updateRuntimeCombo(serverType);
    if (serverName != null) {
        if (server == null) {
            serverName.setEditable(false);
            serverNameToolBar.getControl().setVisible(false);
        } else {
            serverName.setEditable(true);
            serverNameToolBar.getControl().setVisible(serverNameModified);
        }
    }

    if (hostname != null && server != null) {
        hostname.setText(server.getHost());
    }
    listener.serverSelected(server);
    // Fire the property change event. 
    List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin
            .getServerCreationWizardPageExtensions();
    for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) {
        curPageExtension.handlePropertyChanged(
                new PropertyChangeEvent(this, AbstractUIControl.PROP_SERVER_TYPE, oldServerType, serverType));
    }
    // Update the old server type value.
    oldServerType = serverType;

    validate(serverType);
    wizard.update();
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewManualServerComposite.java

License:Open Source License

void setHostnameChangeTimer(String hostName) {
    if (hostnameChangeAction == null) {
        hostnameChangeAction = new HostnameChangedAction(hostName);
    } else {/* w ww.  java  2  s  . c  o  m*/
        hostnameChangeAction.setHostName(hostName);
    }

    if (timer == null) {
        timer = new Timer(300, hostnameChangeAction);
    }
    /*
     * Kick off the timer and then call setMessage if the Timer wasn't
     * previously running because we want to trigger the isComplete on the page
     * so that it stops the user from proceeding to the next page while the
     * timer is running.
     */
    if (!timer.isRunning()) {
        timer.runTimer();
        wizard.setMessage(null, IMessageProvider.NONE);
    } else {
        timer.runTimer();
    }
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewServerComposite.java

License:Open Source License

protected void toggleMode(byte newMode) {
    if (!isVisible())
        return;/* www .j a v  a2 s.com*/

    if (newMode == mode)
        return;

    mode = newMode;
    wizard.setMessage(null, IMessageProvider.NONE);

    if (mode == MODE_EXISTING) {
        stackLayout.topControl = existingComp;
        existingComp.setSelection(existingComp.getSelectedServer());
    } else if (mode == MODE_DETECT) {
        stackLayout.topControl = detectComp2;
        detectComp.setVisible(true);
    } else {
        stackLayout.topControl = manualComp2;
        manualComp.setVisible(true);
    }
    stack.layout();
    if (taskModel != null) {
        taskModel.putObject(WizardTaskUtil.TASK_MODE, new Byte(mode));
        updateTaskModel();
    }
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewServerComposite.java

License:Open Source License

protected void createExistingComposite(Composite comp) {
    existingComp = new ServerComposite(comp, new ServerComposite.ServerSelectionListener() {
        public void serverSelected(IServer server) {
            wizard.setMessage(null, IMessageProvider.NONE);

            // check for compatibility
            if (server != null && module != null) {
                IStatus status = isSupportedModule(server, module);
                if (status != null) {
                    if (status.getSeverity() == IStatus.ERROR) {
                        wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
                        server = null;/*from   ww  w  .  j  a  v a  2s . co m*/
                    } else if (status.getSeverity() == IStatus.WARNING)
                        wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
                    else if (status.getSeverity() == IStatus.INFO)
                        wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
                }
            }

            if (existingWC != null) {
                if (server != null && server.equals(existingWC.getOriginal()))
                    return;
                existingWC = null;
            }
            if (server != null)
                existingWC = server.createWorkingCopy();
            updateTaskModel();
        }
    }, module, launchMode);
    existingComp.setIncludeIncompatibleVersions(true);
    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    data.horizontalSpan = 3;
    data.heightHint = 150;
    existingComp.setLayoutData(data);
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.SelectClientComposite.java

License:Open Source License

/**
 * Handle the selection of a client./*from   w  w  w .  j  a  v  a2 s  .  c o  m*/
 */
protected void handleSelection() {
    int index = elementTable.getSelectionIndex();
    if (index < 0)
        selectedClient = null;
    else
        selectedClient = clients[index];

    taskModel.putObject(WizardTaskUtil.TASK_CLIENT, selectedClient);
    if (selectedClient != null)
        wizard.setMessage(null, IMessageProvider.NONE);
    else
        wizard.setMessage("", IMessageProvider.ERROR);

    String desc = null;
    if (selectedClient != null)
        desc = selectedClient.getDescription();
    if (desc == null)
        desc = "";
    description.setText(desc);

    wizard.update();
}