Search in sources :

Example 66 with Status

use of org.eclipse.core.runtime.Status in project azure-tools-for-java by Microsoft.

the class AppServiceCreateDialog method fillAppServicePlanPricingTiers.

protected void fillAppServicePlanPricingTiers() {
    try {
        comboAppServicePlanPricingTier.removeAll();
        binderAppServicePlanPricingTier = new ArrayList<PricingTier>();
        List<PricingTier> l = createListFromClassFields(PricingTier.class);
        for (PricingTier aspt : l) {
            comboAppServicePlanPricingTier.add(aspt.toString());
            binderAppServicePlanPricingTier.add(aspt);
        }
        if (comboAppServicePlanPricingTier.getItemCount() > 0) {
            comboAppServicePlanPricingTier.select(0);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "fillAppServicePlanPricingTiers@AppServiceCreateDialog", ex));
    }
}
Also used : PricingTier(com.microsoft.azure.management.appservice.PricingTier) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) MalformedURLException(java.net.MalformedURLException)

Example 67 with Status

use of org.eclipse.core.runtime.Status in project azure-tools-for-java by Microsoft.

the class AppServiceCreateDialog method doFillSubscriptions.

private void doFillSubscriptions() {
    try {
        // reset model
        Set<SubscriptionDetail> sdl = AzureModel.getInstance().getSubscriptionToResourceGroupMap().keySet();
        if (sdl == null) {
            System.out.println("sdl is null");
            return;
        }
        comboSubscription.removeAll();
        ;
        binderSubscriptionDetails = new ArrayList<SubscriptionDetail>();
        for (SubscriptionDetail sd : sdl) {
            if (!sd.isSelected())
                continue;
            comboSubscription.add(sd.getSubscriptionName());
            binderSubscriptionDetails.add(sd);
        }
        if (comboSubscription.getItemCount() > 0) {
            comboSubscription.select(0);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "doFillSubscriptions@AppServiceCreateDialog", ex));
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) SubscriptionDetail(com.microsoft.azuretools.authmanage.models.SubscriptionDetail) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) MalformedURLException(java.net.MalformedURLException)

Example 68 with Status

use of org.eclipse.core.runtime.Status in project azure-tools-for-java by Microsoft.

the class WebAppDeployDialog method updateAndFillTable.

private void updateAndFillTable() {
    try {
        ProgressDialog.get(getShell(), "Update Azure Local Cache Progress").run(true, true, new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Updating Azure local cache...", IProgressMonitor.UNKNOWN);
                try {
                    if (monitor.isCanceled()) {
                        throw new CanceledByUserException();
                    }
                    AzureModelController.updateResourceGroupMaps(new UpdateProgressIndicator(monitor));
                    Display.getDefault().asyncExec(new Runnable() {

                        @Override
                        public void run() {
                            doFillTable();
                        }
                    });
                } catch (CanceledByUserException ex) {
                    Display.getDefault().asyncExec(new Runnable() {

                        @Override
                        public void run() {
                            System.out.println("updateAndFillTable(): Canceled by user");
                            cancelPressed();
                        }
                    });
                } catch (Exception ex) {
                    ex.printStackTrace();
                    LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "run@ProgressDialog@updateAndFillTable@AppServiceCreateDialog", ex));
                }
                monitor.done();
            }
        });
    } catch (InvocationTargetException | InterruptedException ex) {
        ex.printStackTrace();
        LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "updateAndFillTable@AppServiceCreateDialog", ex));
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CanceledByUserException(com.microsoft.azuretools.utils.CanceledByUserException) UpdateProgressIndicator(com.microsoft.azuretools.core.utils.UpdateProgressIndicator) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException) CanceledByUserException(com.microsoft.azuretools.utils.CanceledByUserException) IOException(java.io.IOException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 69 with Status

use of org.eclipse.core.runtime.Status in project lwjgl by LWJGL.

the class Activator method start.

/*
	 * (non-Javadoc)
	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
	 */
@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    try {
        String path = LibraryPathUtil.getLWJGLLibraryPath(context);
        Status status = new Status(Status.INFO, PLUGIN_ID, Status.INFO, "Set org.lwjgl.librarypath to " + path, null);
        getLog().log(status);
    } catch (Throwable ex) {
        Status status = new Status(Status.ERROR, PLUGIN_ID, Status.ERROR, "Error setting native LWJGL libraries path: " + ex.toString(), ex);
        getLog().log(status);
        throw new BundleException(status.getMessage(), ex);
    }
}
Also used : Status(org.eclipse.core.runtime.Status) BundleException(org.osgi.framework.BundleException)

Example 70 with Status

use of org.eclipse.core.runtime.Status in project ow by vtst.

the class ClosureCompilerLaunchConfigurationDelegate method launch.

@Override
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    monitor.beginTask(config.getName(), 1);
    monitor.subTask(messages.getString("ClosureCompilerLaunchConfigurationDelegate_prepareCompiler"));
    IReadOnlyStore store = new LaunchConfigurationReadOnlyStore(config);
    List<IResource> resources = record.inputResources.get(store);
    if (resources.isEmpty())
        return;
    // Getting the stores for project configurations
    IProject project = null;
    if (record.useProjectPropertiesForChecks.get(store) || record.useProjectPropertiesForIncludes.get(store)) {
        project = ClosureCompiler.getCommonProject(resources);
        if (project == null)
            throw new CoreException(new Status(Status.ERROR, OwJsClosurePlugin.PLUGIN_ID, messages.getString("ClosureCompilerLaunchConfigurationDelegate_differentProjects")));
    }
    IReadOnlyStore storeForChecks = record.useProjectPropertiesForChecks.get(store) ? new ResourcePropertyStore(project, OwJsClosurePlugin.PLUGIN_ID) : store;
    IReadOnlyStore storeForIncludes = record.useProjectPropertiesForIncludes.get(store) ? new ResourcePropertyStore(project, OwJsClosurePlugin.PLUGIN_ID) : store;
    // Get the output file
    IFile outputFile = getOutputFile(store, resources);
    // Create and configure the compiler
    ClosureCompilerProcess process = new ClosureCompilerProcess(launch);
    Compiler compiler = CompilerUtils.makeCompiler(process.getErrorManager());
    CompilerOptions options = ClosureCompilerOptions.makeForLaunch(storeForChecks, store);
    compiler.initOptions(options);
    // Get the files to compile
    Set<IFile> allFiles, rootFiles;
    List<AbstractJSProject> libraries;
    if (record.manageClosureDependencies.get(store)) {
        // If dependencies are managed, we take all projects containing selected resources,
        // then all their referenced projects.
        // TODO: It should not be allowed to customize the includes in this case, we should always
        // use the project ones.
        Collection<IProject> projects = getProjects(resources);
        Comparator<IProject> comparator = OwJsClosurePlugin.getDefault().getProjectOrderManager().get().reverseOrderComparator();
        ArrayList<IProject> allProjects = ClosureCompiler.getReferencedJavaScriptProjectsRecursively(projects, comparator);
        monitor.subTask(messages.getString("ClosureCompilerLaunchConfigurationDelegate_loadLibraries"));
        libraries = includesProvider.getLibraries(compiler, monitor, allProjects);
        monitor.subTask(messages.getString("ClosureCompilerLaunchConfigurationDelegate_prepareCompiler"));
        allFiles = ClosureCompiler.getJavaScriptFilesOfProjects(allProjects);
        for (IResource resource : resources) {
            if (!(resource instanceof IProject))
                allFiles.addAll(ClosureCompiler.getJavaScriptFiles(resource));
        }
        rootFiles = Utils.getAllContainedFilesWhichAreInSet(resources, allFiles);
    } else {
        // If dependencies are not managed, we take only what has been selected.
        monitor.subTask(messages.getString("ClosureCompilerLaunchConfigurationDelegate_loadLibraries"));
        libraries = includesProvider.getLibraries(compiler, monitor, storeForIncludes);
        monitor.subTask(messages.getString("ClosureCompilerLaunchConfigurationDelegate_prepareCompiler"));
        allFiles = ClosureCompiler.getJavaScriptFiles(resources);
        rootFiles = allFiles;
    }
    // Build the project to compile
    File closureBasePath = ClosureCompiler.getPathOfClosureBase(storeForIncludes);
    Map<IFile, JSUnit> units = makeJSUnits(closureBasePath, allFiles);
    List<JSUnit> rootUnits = new ArrayList<JSUnit>(rootFiles.size());
    for (IFile selectedJsFile : rootFiles) rootUnits.add(units.get(selectedJsFile));
    try {
        JSProject jsProject = makeJSProject(compiler, Lists.newArrayList(units.values()), libraries, closureBasePath);
        List<JSUnit> rootUnitsWithTheirDependencies = jsProject.getSortedDependenciesOf(rootUnits);
        JSModule module = new JSModule("main");
        for (JSUnit unit : rootUnitsWithTheirDependencies) module.add(new CompilerInput(unit.getAst(false)));
        monitor.subTask(messages.getString("ClosureCompilerLaunchConfigurationDelegate_runCompiler"));
        compiler.compileModules(getExterns(compiler, monitor, storeForIncludes), Collections.singletonList(module), options);
        if (outputFile.exists()) {
            outputFile.setContents(new ByteArrayInputStream(compiler.toSource().getBytes("UTF-8")), false, false, monitor);
        } else {
            outputFile.create(new ByteArrayInputStream(compiler.toSource().getBytes("UTF-8")), false, monitor);
        }
        outputFile.setCharset("UTF-8", monitor);
        ClosureFilePropertyRecord.getInstance().generatedByCompiler.set(new ResourcePropertyStore(outputFile, OwJsClosurePlugin.PLUGIN_ID), true);
        process.setTerminated();
        monitor.done();
    } catch (CircularDependencyException e) {
        throw new CoreException(new Status(Status.ERROR, OwJsClosurePlugin.PLUGIN_ID, e.getLocalizedMessage(), e));
    } catch (IOException e) {
        throw new CoreException(new Status(Status.ERROR, OwJsClosurePlugin.PLUGIN_ID, e.getLocalizedMessage(), e));
    }
}
Also used : AbstractJSProject(net.vtst.ow.closure.compiler.deps.AbstractJSProject) JSProject(net.vtst.ow.closure.compiler.deps.JSProject) IFile(org.eclipse.core.resources.IFile) ArrayList(java.util.ArrayList) LaunchConfigurationReadOnlyStore(net.vtst.eclipse.easy.ui.properties.stores.LaunchConfigurationReadOnlyStore) CircularDependencyException(com.google.javascript.jscomp.deps.SortedDependencies.CircularDependencyException) Status(org.eclipse.core.runtime.Status) AbstractCompiler(com.google.javascript.jscomp.AbstractCompiler) ClosureCompiler(net.vtst.ow.eclipse.js.closure.compiler.ClosureCompiler) Compiler(com.google.javascript.jscomp.Compiler) IOException(java.io.IOException) JSUnit(net.vtst.ow.closure.compiler.deps.JSUnit) IProject(org.eclipse.core.resources.IProject) IReadOnlyStore(net.vtst.eclipse.easy.ui.properties.stores.IReadOnlyStore) CompilerInput(com.google.javascript.jscomp.CompilerInput) CoreException(org.eclipse.core.runtime.CoreException) AbstractJSProject(net.vtst.ow.closure.compiler.deps.AbstractJSProject) ByteArrayInputStream(java.io.ByteArrayInputStream) ResourcePropertyStore(net.vtst.eclipse.easy.ui.properties.stores.ResourcePropertyStore) CompilerOptions(com.google.javascript.jscomp.CompilerOptions) ClosureCompilerOptions(net.vtst.ow.eclipse.js.closure.compiler.ClosureCompilerOptions) JSModule(com.google.javascript.jscomp.JSModule) IFile(org.eclipse.core.resources.IFile) SourceFile(com.google.javascript.jscomp.SourceFile) File(java.io.File) IResource(org.eclipse.core.resources.IResource)

Aggregations

Status (org.eclipse.core.runtime.Status)538 IStatus (org.eclipse.core.runtime.IStatus)513 CoreException (org.eclipse.core.runtime.CoreException)248 IOException (java.io.IOException)110 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)84 ArrayList (java.util.ArrayList)62 InvocationTargetException (java.lang.reflect.InvocationTargetException)60 IFile (org.eclipse.core.resources.IFile)54 File (java.io.File)53 MultiStatus (org.eclipse.core.runtime.MultiStatus)43 IResource (org.eclipse.core.resources.IResource)41 IPath (org.eclipse.core.runtime.IPath)41 InputStream (java.io.InputStream)36 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)34 PartInitException (org.eclipse.ui.PartInitException)32 IProject (org.eclipse.core.resources.IProject)31 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)25 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)24 SubMonitor (org.eclipse.core.runtime.SubMonitor)24 ITask (com.cubrid.common.core.task.ITask)23