Example usage for org.eclipse.jdt.core IJavaProject getProject

List of usage examples for org.eclipse.jdt.core IJavaProject getProject

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IJavaProject getProject.

Prototype

IProject getProject();

Source Link

Document

Returns the IProject on which this IJavaProject was created.

Usage

From source file:com.google.gwt.eclipse.core.launch.processors.SuperDevModeCodeServerMainTypeProcessor.java

License:Open Source License

private static String computeMainTypeName(ILaunchConfigurationWorkingCopy config, IJavaProject javaProject,
        ClassFinder classFinder) throws CoreException {
    IProject project = javaProject.getProject();

    // If there are multiple Super Dev mode entry points, the logic would
    // go here, like DevMode.
    if (GWTNature.isGWTProject(project)) {
        return MainType.GWT_SUPERDEVMODE.mainTypeName;
    } else {//from   w w w  .j  a  v  a 2s.co m
        return null;
    }
}

From source file:com.google.gwt.eclipse.core.launch.processors.SuperDevModeCodeServerMainTypeProcessor.java

License:Open Source License

public void update(ILaunchConfigurationWorkingCopy config, IJavaProject javaProject, List<String> programArgs,
        List<String> vmArgs) throws CoreException {
    if (!GWTNature.isGWTProject(javaProject.getProject())) {
        return;//from w w w . j  a  v  a 2 s . c  om
    }

    String currentMainTypeName = LaunchConfigurationProcessorUtilities.getMainTypeName(config);
    String previouslySetMainTypeName = getPreviouslySetMainTypeName(config);

    if (!StringUtilities.isEmpty(currentMainTypeName)
            && !currentMainTypeName.equals(previouslySetMainTypeName)) {
        // Our previously set main type must have been changed by the user, do not
        // adjust
        return;
    }

    String newMainTypeName = computeMainTypeName(config, javaProject, classFinder);
    if (StringUtilities.isEmpty(newMainTypeName) || newMainTypeName.equals(currentMainTypeName)) {
        return;
    }

    setMainTypeName(config, newMainTypeName);
}

From source file:com.google.gwt.eclipse.core.launch.ui.GWTSettingsTab.java

License:Open Source License

@Override
public void initializeFrom(ILaunchConfiguration config) {
    blockUpdateLaunchConfigurationDialog = true;
    IJavaProject javaProject = null;

    try {//from w w w  .j a v  a  2s.  c  o  m
        super.initializeFrom(config);
        try {

            if (urlSelectionBlock != null) {
                urlSelectionBlock.initializeFrom(config);
            }

            if (developmentModeBlock != null) {
                developmentModeBlock.initializeFrom(config);
            }

            javaProject = getJavaProject();

            entryPointModulesBlock.setJavaProject(javaProject);

            // Can't get the project's entry point modules if this launch
            // configuration has not been assigned to a project
            if (javaProject != null) {
                // The default set of entry point modules is the project's
                // set of defined entry point modules (specified in project
                // properties).
                IProject project = javaProject.getProject();
                entryPointModulesBlock
                        .setDefaultModules(ModuleArgumentProcessor.getDefaultModules(project, config));

                // Initialize the selected set of entry point modules
                List<String> launchConfigModules = GWTLaunchConfiguration.getEntryPointModules(config);
                entryPointModulesBlock.setModules(launchConfigModules);
            }

            if (performGwtCompileButton != null) {
                boolean performGwtCompile = LaunchConfigurationAttributeUtilities.getBoolean(config,
                        SpeedTracerLaunchConfiguration.Attribute.PERFORM_GWT_COMPILE);
                performGwtCompileButton.setSelection(performGwtCompile);
            }

        } catch (CoreException e) {
            // Purposely ignored; this happens when the java project does
            // not exist
        }

        maybeGrayControls(javaProject);
        updateEnabledState();

    } finally {
        blockUpdateLaunchConfigurationDialog = false;
    }
}

From source file:com.google.gwt.eclipse.core.launch.ui.GWTSettingsTab.java

License:Open Source License

/**
 * If this project doesn't have the GWT nature, gray out all the controls
 * recursively.//  w w  w .  ja  v  a2 s . co m
 */
protected void maybeGrayControls(IJavaProject javaProject) {

    boolean isGWTProject = javaProject != null && GWTNature.isGWTProject(javaProject.getProject());
    String message = isGWTProject ? null
            : "GWT is not enabled for this project. You can enable it in the project's properties.";

    setMessage(message);
    SWTUtilities.setEnabledRecursive(comp, isGWTProject);
}

From source file:com.google.gwt.eclipse.core.launch.ui.GWTSettingsTab.java

License:Open Source License

private IProject getProject() throws CoreException {
    IJavaProject javaProject = getJavaProject();
    if (javaProject == null || !javaProject.exists()) {
        throw new CoreException(
                new Status(IStatus.ERROR, GWTPlugin.PLUGIN_ID, "Could not get a valid Java project"));
    }/*www  . java 2  s. c om*/

    return javaProject.getProject();
}

From source file:com.google.gwt.eclipse.core.launch.ui.JUnitLaunchConfigurationTabDecorator.java

License:Open Source License

@Override
public boolean isValid(ILaunchConfiguration config) {
    try {//from  ww  w. java  2s .co m
        IJavaProject javaProject = JavaRuntime.getJavaProject(getCurrentLaunchConfiguration());

        if (javaProject != null && !GWTNature.isGWTProject(javaProject.getProject())) {
            setErrorMessage("Selected project does not have GWT enabled.");
            return false;
        }
    } catch (CoreException e) {
        GWTPluginLog.logError(e);
    }

    return super.isValid(config);
}

From source file:com.google.gwt.eclipse.core.launch.ui.tabs.GwtCompilerSettingsTab.java

License:Open Source License

@Override
public void initializeFrom(ILaunchConfiguration config) {
    blockUpdateLaunchConfigurationDialog = true;
    IJavaProject javaProject = null;

    try {/*from w w  w  . ja  v  a 2 s  .  co m*/
        super.initializeFrom(config);
        try {
            if (compilerModeBlock != null) {
                compilerModeBlock.initializeFrom(config);
            }

            javaProject = getJavaProject();

            entryPointModulesBlock.setJavaProject(javaProject);

            // Can't get the project's entry point modules if this launch
            // configuration has not been assigned to a project
            if (javaProject != null) {
                // The default set of entry point modules is the project's
                // set of defined entry point modules (specified in project
                // properties).
                IProject project = javaProject.getProject();
                entryPointModulesBlock
                        .setDefaultModules(ModuleArgumentProcessor.getDefaultModules(project, config));

                // Initialize the selected set of entry point modules
                List<String> launchConfigModules = GWTLaunchConfiguration.getEntryPointModules(config);
                entryPointModulesBlock.setModules(launchConfigModules);
            }

        } catch (CoreException e) {
            // Purposely ignored; this happens when the java project does
            // not exist
        }

        maybeGrayControls(javaProject);

    } finally {
        blockUpdateLaunchConfigurationDialog = false;
    }
}

From source file:com.google.gwt.eclipse.core.launch.ui.tabs.GwtCompilerSettingsTab.java

License:Open Source License

/**
 * If this project doesn't have the GWT nature, gray out all the controls recursively.
 *///  w  ww . ja  va2  s.c o m
protected void maybeGrayControls(IJavaProject javaProject) {
    boolean isGWTProject = javaProject != null && GWTNature.isGWTProject(javaProject.getProject());
    String message = isGWTProject ? null : "GWT is not enabled for this project.";

    setMessage(message);
    SWTUtilities.setEnabledRecursive(comp, isGWTProject);
}

From source file:com.google.gwt.eclipse.core.launch.ui.tabs.GWTSettingsTab.java

License:Open Source License

@Override
public void initializeFrom(ILaunchConfiguration config) {
    updateLaunchConfigurationDialogBlock = true;
    IJavaProject javaProject = null;

    try {// w ww . jav a 2 s  . c  o m
        super.initializeFrom(config);
        try {
            if (selectionBlock != null) {
                selectionBlock.initializeFrom(config);
            }

            if (developmentModeBlock != null) {
                developmentModeBlock.initializeFrom(config);
                developmentModeBlock.setTitle();
            }

            if (urlSelectionBlock != null) {
                urlSelectionBlock.initializeFrom(config);
            }

            javaProject = getJavaProject();
            entryPointModulesSelectionBlock.setJavaProject(javaProject);

            // Can't get the project's entry point modules if this launch
            // configuration has not been assigned to a project
            if (javaProject != null) {
                // The default set of entry point modules is the project's
                // set of defined entry point modules (specified in project
                // properties).
                IProject project = javaProject.getProject();
                entryPointModulesSelectionBlock
                        .setDefaultModules(ModuleArgumentProcessor.getDefaultModules(project, config));

                // Initialize the selected set of entry point modules
                List<String> launchConfigModules = GWTLaunchConfiguration.getEntryPointModules(config);
                entryPointModulesSelectionBlock.setModules(launchConfigModules);
            }
        } catch (CoreException e) {
            // Purposely ignored; this happens when the java project does
            // not exist
        }

        maybeGrayControls(javaProject);
        updateEnabledState();
    } finally {
        updateLaunchConfigurationDialogBlock = false;
    }
}

From source file:com.google.gwt.eclipse.core.launch.ui.tabs.GWTSettingsTab.java

License:Open Source License

/**
 * If this project doesn't have the GWT nature, gray out all the controls recursively.
 *//*ww w  . j  a va 2  s. c o m*/
protected void maybeGrayControls(IJavaProject javaProject) {
    boolean isGWTProject = javaProject != null && GWTNature.isGWTProject(javaProject.getProject());
    String message = isGWTProject ? null
            : "GWT is not enabled for this project. You can enable it in the project's properties.";

    setMessage(message);
    SWTUtilities.setEnabledRecursive(comp, isGWTProject);
}