Package de.innovationgate.eclipse.wgadesigner.natures

Examples of de.innovationgate.eclipse.wgadesigner.natures.WGARuntime


      if (_project != null && !_project.hasNature(WGADesignerPlugin.NATURE_WGA_RUNTIME)) {
        boolean result = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Migrate project '" + _project.getName() + "'?", "Are you sure you want to migrate the project '" + _project.getName() + "' to an WGA runtime project? Migration will add the runtime nature and create necessary default resources.");
        if (result) {
          JDTUtils.addNature(_project, WGADesignerPlugin.NATURE_WGA_RUNTIME);     
         
          WGARuntime runtime = (WGARuntime) _project.getNature(WGADesignerPlugin.NATURE_WGA_RUNTIME);
         
          // set wga distribution
          WGADeploymentManager manager = WGADesignerPlugin.getDefault().getWGADeploymentManager();
          WGADeployment deployment = null;
          if (manager.hasDeployment(WGADeploymentManager.DEFAULT_DEPLOYMENT_NAME)) {
            deployment = manager.getDefaultDeployment();
          } else if (manager.getDeployments().size() > 0) {
            deployment = manager.getDeployments().get(0);
          }
          if (deployment != null) {
            runtime.getConfiguration().setWgaDistribution(deployment.getName());
          }
         
          runtime.flushConfig();
         
          // configure tomcat
          Map<String,String> variables = new HashMap<String,String>();
          TomcatUtils.getInstance().initConfDir(runtime.getCatalinaConf().getLocation().toFile(), variables);       
 
          _project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
        }
      }
    } catch (Exception e) {
View Full Code Here


  public void run(IAction action){
    call();
  }

  public static void call() {
    final WGARuntime temp = TomcatUtils.getInstance().getCurrentRuntime();
    if (temp != null && TomcatUtils.getInstance().isRunning(temp)) {
      Job job = new Job("WGA Runtime stop") {
 
        @Override
        protected IStatus run(IProgressMonitor monitor) {
          try {
            monitor.beginTask("Stopping WGA runtime '" + temp.getName() + "'.", 1);
            TomcatUtils.getInstance().stop(new SubProgressMonitor(monitor, 1));             
            return Status.OK_STATUS;
          } catch (Exception e) {
            return new Status(Status.ERROR, WGADesignerPlugin.PLUGIN_ID, "Unable to stop WGA runtime '" + temp.getName() + "'.", e);
          } finally {
            monitor.done();
          }
        }
       
View Full Code Here

  public void run(IAction action){
    call();
  }

  public static void call() {
    final WGARuntime temp = TomcatUtils.getInstance().getCurrentRuntime();
    if (temp != null && TomcatUtils.getInstance().isRunning(temp)) {
      Job job = new Job("WGA Runtime restart") {
 
        @Override
        protected IStatus run(IProgressMonitor monitor) {
          try {
            monitor.beginTask("Restarting WGA runtime '" + temp.getName() + "'.", 2);
            TomcatUtils.getInstance().stop(new SubProgressMonitor(monitor, 1));   
            TomcatUtils.getInstance().start(temp, new SubProgressMonitor(monitor, 1));
            return Status.OK_STATUS;
          } catch (Exception e) {
            return new Status(Status.ERROR, WGADesignerPlugin.PLUGIN_ID, "Unable to restart WGA runtime '" + temp.getName() + "'.", e);
          } finally {
            monitor.done();
          }
        }
       
View Full Code Here

      }
  }

  public static void openBrowser(String contentStore, IFile module) {   
    try {           
      WGARuntime currentRuntime = TomcatUtils.getInstance().getCurrentRuntime();
      if (currentRuntime != null) {
        URL rootURL = currentRuntime.getRootURL();
        if (rootURL != null) {
          IWebBrowser browser = WGADesignerPlugin.getDefault().createBrowser(BROWSER_ID);
          URL url = WGADesignStructureHelper.generateHttpURL(rootURL, contentStore, module);
          browser.openURL(url);
        }
View Full Code Here

      }
    }
  }
 
  public static String determineContentStoreOfFile(IFile tmlfile) {     
      WGARuntime currentRuntime = TomcatUtils.getInstance().getCurrentRuntime();
        if (currentRuntime != null) {
            try {
               
                            
                Map<String, IContainer> contentDesign = currentRuntime.getConnectedDesignContainers();               
               
                for(String key : contentDesign.keySet()){
                    IContainer currentDesignFolder = contentDesign.get(key);
                    WGADesignStructureHelper helper = new WGADesignStructureHelper(currentDesignFolder);
                    if(helper.isWGADesignResourceOfCurrentDesign(tmlfile)){
                        return key;
                    }
                }  
                IFolder[] pluginFolders = currentRuntime.getPluginsAsFolder(true);  
                for(IFolder currentFolder : pluginFolders){                 
                    WGADesignStructureHelper helper = new WGADesignStructureHelper(currentFolder);
                    if(helper.isWGADesignResourceOfCurrentDesign(tmlfile)){             
                        WGADesignConfigurationModelWrapper wrapper = new WGADesignConfigurationModelWrapper(helper.getSyncInfo());         
                        return "plugin-"+wrapper.getDesignKey();
View Full Code Here

    _warning = warning;   
  }
 
  public void linkActivated() {
    try {
      WGARuntime runtime = TomcatUtils.getInstance().getCurrentRuntime();
      if (runtime != null) {
          // determine designcontainer of selected tml warning
          IContainer designContainer = null;
          if (_warning.getDb() != null) {
              if (!_warning.getDb().startsWith("plugin-")) {
                  WGAConfiguration wgaConfiguration = runtime.retrieveWGAConfig(false);
                  ContentStore cs = wgaConfiguration.getContentStore(_warning.getDb());
                  if (cs != null && cs.getDesign() != null && cs.getDesign().getSource() != null && cs.getDesign().getSource().equals("fs-designs")) {
                      IFolder[] designFolders = runtime.getDesignsAsFolder(true);
                      for (IFolder designFolder : designFolders) {
                          if (designFolder.getName().equals(cs.getDesign().getName())) {
                              designContainer = designFolder;
                              break;
                          }
                      }
                  }
              } else {
                  IFolder[] pluginFolders = runtime.getPluginsAsFolder(true);
                        for (IFolder pluginFolder : pluginFolders) {
                            if (WGADesignStructureHelper.isDesignFolder(pluginFolder)) {
                                WGADesignStructureHelper helper = new WGADesignStructureHelper(pluginFolder);
                                WGADesignConfigurationModel model = helper.createModel();
                                if (model != null && model.hasPluginConfig()) {
View Full Code Here

   
    List<WGARuntime> runtimeList = new ArrayList<WGARuntime>(WGADesignerPlugin.getAllRuntimes().values());
    Collections.sort(runtimeList, new WGARuntimeSortByName());
    Iterator<WGARuntime> runtimes = runtimeList.iterator();
    while (runtimes.hasNext()) {
      WGARuntime runtime = runtimes.next();
     
      MenuItem runtimeItem = new MenuItem(menu, SWT.CASCADE);
      runtimeItem.setText(runtime.getName());
      runtimeItem.setData(runtime);
     
      Menu runtimeMenu = new Menu(parent.getShell(), SWT.DROP_DOWN);
      runtimeItem.setMenu(runtimeMenu);
     
View Full Code Here

  }

  public void widgetSelected(SelectionEvent e) {
    if (e.getSource() instanceof MenuItem) {
      MenuItem item = (MenuItem) e.getSource();
      WGARuntime runtime = (WGARuntime) item.getData();
      String command = (String) item.getData(ATTRIB_COMMAND);
      if (COMMAND_START.equals(command)) {
        StartWGARuntime.call(runtime);
      } else if (COMMAND_STOP.equals(command)){
        StopWGARuntime.call();
      } else if (COMMAND_EDIT.equals(command)) {       
        try {
          WorkbenchUtils.openEditor(WGADesignerPlugin.getDefault().getWorkbench(), runtime.getConfigFile(), ResourceIDs.EDITOR_WGA_RUNTIME);
        } catch (PartInitException e1) {
          WorkbenchUtils.showErrorDialog(WGADesignerPlugin.getDefault(), _window.getShell(), "Unable to open runtime configuration.", "Unable to open configuration of runtime '" + runtime.getName() + "'.", e1);
        }
      }
    }
   
  }
View Full Code Here

    List<RefactoringInfo> links = new ArrayList<RefactoringInfo>();
    // iterate over runtimes and check for affected dirlinks
    Map<String, WGARuntime> allRuntimes = WGADesignerPlugin.getAllRuntimes();
    Iterator<String> itRT = allRuntimes.keySet().iterator();
    while (itRT.hasNext()) {
      WGARuntime currentRuntime = allRuntimes.get(itRT.next());
      IFolder[] designs = currentRuntime.getDesignsAsFolder(false);
      for (IFolder folder : designs) {
        if (WGADesignStructureHelper.isDirlinkFolder(folder)) {
          File target = WGUtils.resolveDirLink(folder.getLocation().toFile());
          IPath targetPath;
          targetPath = new Path(target.getCanonicalPath());
          // check if targetpath is effected by change
          if (container.getLocation().isPrefixOf(targetPath)) {
            DirlinkRefactoringInformation info = new DirlinkRefactoringInformation(container, arguments);
            info.setFile(folder.getFile(WGUtils.DIRLINK_FILE));
            links.add(info);
          }
        }
      }
     
      IFolder[] plugins = currentRuntime.getPluginsAsFolder(false);
      for (IFolder folder : plugins) {
        if (WGADesignStructureHelper.isDirlinkFolder(folder)) {
          File target = WGUtils.resolveDirLink(folder.getLocation().toFile());
          IPath targetPath;
          targetPath = new Path(target.getCanonicalPath());
          // check if targetpath is effected by change
          if (container.getLocation().isPrefixOf(targetPath)) {
            DirlinkRefactoringInformation info = new DirlinkRefactoringInformation(container, arguments);
            info.setFile(folder.getFile(WGUtils.DIRLINK_FILE));
            links.add(info);
          }
        }             
      }
     
      // iterate over contentstores and check design references
      Iterator<ContentStore> itCS = currentRuntime.retrieveWGAConfig(false).getContentStores().iterator();
      while (itCS.hasNext()) {
        ContentStore currentContentStore = itCS.next();
        Design currentDesign = currentContentStore.getDesign();

        if (currentDesign != null && currentDesign.getSource() != null && currentDesign.getSource().equals(Constants.DESIGNCOL_FILESYSTEM)) {
          //IPath designPath = currentRuntime.getDesignRoot().getFullPath().append(currentDesign.getName());       

          if (container.getParent() != null && container.getParent().equals(currentRuntime.getDesignRoot()) && container.getName().equals(currentDesign.getName())) {
            ContentStoreRefactoringInfo info = new ContentStoreRefactoringInfo(container, arguments);
            info.setRuntime(currentRuntime);
            info.setContentStoreUID(currentContentStore.getUid());
            links.add(info);
          }
View Full Code Here

      call(runtime, false);
  }

  public static void call(WGARuntime runtime, boolean joinAndWaitForStartup) {
    boolean force = false;
    WGARuntime current = TomcatUtils.getInstance().getCurrentRuntime();
    if (TomcatUtils.getInstance().isRunning() && current != null && !current.getProject().getName().equals(runtime.getProject().getName())) {
      force = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Confirm WGA runtime change", "Another WGA runtime '" + current.getProject().getName()
          + "' is started. Are you sure you want to terminate this instance and start '" + runtime.getProject().getName() + "' instead ?");
    }

    if (!TomcatUtils.getInstance().isRunning() || force) {
      // check preconditions
      if (TomcatUtils.getInstance().isSocketInUse()) {
        int port = WGADesignerPlugin.getDefault().getPreferenceStore().getInt(PreferenceConstants.TOMCAT_SERVER_PORT);
        MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Unable to start WGA runtime",
            "Unable to start WGA runtime. The socket '127.0.0.1:" + port + "' is used by another process. Please terminate this process first.");
        return;
      }

      final WGARuntime temp = runtime;
      Job job = new Job("WGA Runtime start") {

        @Override
        protected IStatus run(IProgressMonitor monitor) {
          try {
            monitor.beginTask("Starting WGA runtime '" + temp.getName() + "'.", 2);
            TomcatUtils.getInstance().stop(new SubProgressMonitor(monitor, 1));
            TomcatUtils.getInstance().start(temp, new SubProgressMonitor(monitor, 1));
            return Status.OK_STATUS;
          } catch (Exception e) {
            return new Status(Status.ERROR, WGADesignerPlugin.PLUGIN_ID, "Unable to start WGA runtime '" + temp.getName() + "'.", e);
          } finally {
            monitor.done();
          }
        }
View Full Code Here

TOP

Related Classes of de.innovationgate.eclipse.wgadesigner.natures.WGARuntime

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.