Nodeclipse / nodeclipse

Nodeclipse-1 : Eclipse plugin for Node.js, PhantomJS development (Nodeclipse core plugin); Maven and Gradle (with Android) plugins
https://nodeclipse.github.io/
158 stars 76 forks source link

Activator-cannot-be-resolved #77

Closed paulvi closed 11 years ago

paulvi commented 11 years ago

While developing 0.6 a problem occurred that was not before.

When launching Node.js for .js file

activator-cannot-be-resolved-dialog

More details from Error Log

activator-cannot-be-resolved

Related code

import org.nodeclipse.ui.Activator;
import org.nodeclipse.ui.preferences.PreferenceConstants;

public class NodeDebugUtil {
    private static final String CONFIG_NAME = "STANDALONE_V8";
    //public static final String LAUNCH_CONFIGURATION_TYPE_ID = "org.chromium.debug.ui.LaunchType$StandaloneV8";
    private static final String LAUNCH_CONFIGURATION_TYPE_ID = "org.nodeclipse.debug.launch.LaunchType$StandaloneV8";

    public static void launch(final String mode, ILaunch launch,
            IProgressMonitor monitor) throws CoreException {
        ILaunchConfigurationType type = DebugPlugin
                .getDefault()
                .getLaunchManager()
                .getLaunchConfigurationType(LAUNCH_CONFIGURATION_TYPE_ID);

        if (type != null) {
            ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(
                    null, CONFIG_NAME);
            workingCopy.setAttribute("debug_host", "localhost");
            //workingCopy.setAttribute("debug_port", 5858);
            IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
            int nodeDebugPort = preferenceStore.getInt(PreferenceConstants.NODE_DEBUG_PORT);
            if (nodeDebugPort==0) { nodeDebugPort=5858;};
            workingCopy.setAttribute("debug_port", nodeDebugPort);
            final ILaunchConfiguration config = workingCopy.doSave();
            // super.launch(config, mode, launch, monitor);
            Display.getDefault().asyncExec(new Runnable() {
                @Override
                public void run() {
                    DebugUITools.launch(config, mode);
                }
            });
        }       
    }

Code of 0.5 version

import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.swt.widgets.Display;

public class NodeDebugUtil {
    private static final String CONFIG_NAME = "STANDALONE_V8";
    // public static final String LAUNCH_CONFIGURATION_TYPE_ID =
    // "org.chromium.debug.ui.LaunchType$StandaloneV8";
    private static final String LAUNCH_CONFIGURATION_TYPE_ID = "org.nodeclipse.debug.launch.LaunchType$StandaloneV8";

    public static void launch(final String mode, ILaunch launch,
            IProgressMonitor monitor) throws CoreException {
        ILaunchConfigurationType type = DebugPlugin.getDefault()
                .getLaunchManager()
                .getLaunchConfigurationType(LAUNCH_CONFIGURATION_TYPE_ID);

        if (type != null) {
            ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(
                    null, CONFIG_NAME);
            workingCopy.setAttribute("debug_host", "localhost");
            workingCopy.setAttribute("debug_port", 5858);
            final ILaunchConfiguration config = workingCopy.doSave();
            // super.launch(config, mode, launch, monitor);
            Display.getDefault().asyncExec(new Runnable() {
                @Override
                public void run() {
                    DebugUITools.launch(config, mode);
                }
            });
        }
    }
paulvi commented 11 years ago

There problem was on Enide Moster. And it was not before.

The only code changes is calling org.nodeclipse.ui.Activator (from .ui) and Preferences from .ui.

I only wonder why before it was OK. Is it really not good calling Activator from other bundle?

Need to check on other Eclipse.

paulvi commented 11 years ago

Doesn't appear again (on other PC or in new Eclipse instance)