public void init(IWorkbench workbench, IStructuredSelection selection) {
   if (selection instanceof TreeSelection) {
     try {
       TreeSelection treeSelection = (TreeSelection) selection;
       for (TreePath path : treeSelection.getPaths()) {
         for (int i = 0; i < path.getSegmentCount(); i++) {
           Object obj = path.getSegment(i);
           if (obj instanceof Category<?>) {
             setLighthouseDomain(((Category<?>) obj).getLighthouseDomain());
           }
           if (obj instanceof Operation) {
             addOperation((Operation) obj);
           }
           if (obj instanceof LighthouseDomain) {
             setLighthouseDomain((LighthouseDomain) obj);
           }
           if (obj instanceof Deployment) {
             addDeployment((Deployment) obj);
           }
         }
       }
       if (treeSelection.getPaths().length == 0
           || (selectedDeployments == null && selectedOperations == null)) {
         tryToInitFromActiveEditor();
       }
     } catch (Exception e) {
       OperationsUI.getPlugin()
           .getLog()
           .log(new Status(IStatus.ERROR, OperationsUI.PLUGIN_ID, e.getMessage(), e));
     }
   } else {
     tryToInitFromActiveEditor();
   }
 }
 @Override
 public void fillContextMenu(IMenuManager menu) {
   // MOD mzhao user readonly role on svn repository mode.
   if (!isShowMenu()) {
     return;
   }
   TreeSelection treeSelection = ((TreeSelection) this.getContext().getSelection());
   if (!treeSelection.isEmpty()) {
     Iterator iterator = treeSelection.iterator();
     while (iterator.hasNext()) {
       Object obj = iterator.next();
       if (obj instanceof ReportAnalysisRepNode) {
         ReportAnalysisRepNode repAnaNode = (ReportAnalysisRepNode) obj;
         TDQReportItem reportItem = repAnaNode.getReportItem();
         if (CorePlugin.getDefault().itemIsOpening(reportItem, false)) {
           // if the report's editor is opening, don't show the menu
           return;
         }
       } else {
         // if include other type node, don't show the menu
         return;
       }
     }
   }
   // show the menu
   menu.add(new RemoveAnalysisAction());
 }
  @Override
  public boolean isEnabled() {

    // Check if we are closing down
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
      return false;
    }

    // Get the selection
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IWorkbenchPart part = page.getActivePart();
    if (part == null) {
      return false;
    }
    ISelectionProvider selectionProvider = part.getSite().getSelectionProvider();
    if (selectionProvider == null) {
      return false;
    }
    ISelection selection = selectionProvider.getSelection();

    // Make sure there is only one selection and that it is an experiment
    fExperiment = null;
    if (selection instanceof TreeSelection) {
      TreeSelection sel = (TreeSelection) selection;
      // There should be only one item selected as per the plugin.xml
      Object element = sel.getFirstElement();
      if (element instanceof TmfExperimentElement) {
        fExperiment = (TmfExperimentElement) element;
      }
    }

    return (fExperiment != null);
  }
Exemple #4
0
 /** Handles the verify action. Checks whether is can be done or not. */
 private void handleVerify(boolean step) {
   if (!shouldVerify()) return;
   TreeSelection s = ((TreeSelection) (fileTree.getSelection()));
   TreeProject p = (TreeProject) s.getPaths()[0].getFirstSegment();
   Object o = s.getFirstElement();
   if (!(o instanceof IFile)) return;
   VerifyJob.verify((IFile) o, p.java_project, step);
   close();
 }
  @Override
  public void run() {
    TreeSelection tsl = (TreeSelection) treeViewer.getSelection();
    if (tsl.getFirstElement() instanceof UiModelSession) {
      UiModelSession sess = (UiModelSession) tsl.getFirstElement();
      deleteSession(sess);
    }

    OprofileUiPlugin.getDefault().getOprofileView().refreshView();
  }
 /**
  * Lookup selected objects in UI.
  *
  * @return
  */
 private List<Object> lookupSelectedElements() {
   IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
   ISelection selection = page.getSelection();
   System.out.println("check " + selection);
   if (selection instanceof IStructuredSelection) {
     IStructuredSelection structuredSelection = (IStructuredSelection) selection;
     return structuredSelection.toList();
   } else if (selection instanceof TreeSelection) {
     TreeSelection treeSelection = (TreeSelection) selection;
     return treeSelection.toList();
   }
   return null;
 }
  /*
   * (non-Javadoc)
   *
   * @see org.talend.designer.fileoutputxml.ui.footer.AbstractTreeNodeButton#updateButtonStatus()
   */
  @Override
  protected void updateStatus(TreeSelection selection) {
    if (selection.isEmpty()) {
      getButton().setEnabled(false);
      return;
    }
    final TreePath[] paths = selection.getPaths();
    boolean sameSegment = true;
    for (int i = 0; i < paths.length - 1; i++) {
      if (paths[i].getSegmentCount() != paths[i + 1].getSegmentCount()) {
        sameSegment = false;
      }
    }
    if (sameSegment) {
      getButton().setEnabled(true);
    } else {
      getButton().setEnabled(false);
      return;
    }

    // if same segment ,they have the same parent and parent must be an element
    final Element parent = (Element) ((FOXTreeNode) selection.getFirstElement()).getParent();
    if (parent == null) {
      getButton().setEnabled(false);
      return;
    }
    final List<? extends FOXTreeNode> attrChildren = parent.getAttributeChildren();
    final List<? extends FOXTreeNode> nameSpaceChildren = parent.getNameSpaceChildren();
    final List<FOXTreeNode> elementChildren = parent.getElementChildren();
    final Iterator iterator = selection.iterator();
    while (iterator.hasNext()) {
      final Object next = iterator.next();
      if (next instanceof Attribute) {
        if (attrChildren.contains(next) && attrChildren.indexOf(next) == 0) {
          getButton().setEnabled(false);
          return;
        }
      } else if (next instanceof NameSpaceNode) {
        if (nameSpaceChildren.contains(next) && nameSpaceChildren.indexOf(next) == 0) {
          getButton().setEnabled(false);
          return;
        }
      } else if (next instanceof Element) {
        if (elementChildren.contains(next) && elementChildren.indexOf(next) == 0) {
          getButton().setEnabled(false);
          return;
        }
      }
    }
  }
  @Override
  public IStatus validateDrop(
      final Object target, final int operation, final TransferData transferType) {
    final ISelection sel =
        (ISelection) LocalSelectionTransfer.getTransfer().nativeToJava(transferType);
    final TreeSelection s = (TreeSelection) sel;
    final IErlElement e = (IErlElement) s.getFirstElement();

    if (e instanceof IErlFunctionClause) {
      if (target instanceof IErlElement || target instanceof IFile) {
        return Status.OK_STATUS;
      }
    }
    return Status.CANCEL_STATUS;
  }
 /**
  * @param selection
  * @return first element of the selection
  */
 public static Object getFirstSelectedElement(ISelection selection) {
   if (selection instanceof TreeSelection) {
     TreeSelection treeSelection = (TreeSelection) selection;
     return treeSelection.getFirstElement();
   } else if (selection instanceof StructuredSelection) {
     StructuredSelection structuredSelection = (StructuredSelection) selection;
     return structuredSelection.getFirstElement();
   } else if (selection instanceof IFileEditorInput) {
     IFileEditorInput editorInput = (FileEditorInput) selection;
     return editorInput.getFile();
   } else if (selection instanceof TextSelection) {
     return null;
   } else {
     throw new RuntimeException(Messages.GeneratorUtils_SelectionNotSupported);
   }
 }
  /**
   * Get all selected element of the specified type.
   *
   * @param expectedType
   * @return
   * @throws ExecutionException
   */
  private <T> List<T> getAllSelectionOfType(ExecutionEvent event, Class<T> expectedType)
      throws ExecutionException {

    ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
    // IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    // ISelection selection = page.getSelection();
    System.out.println("check " + selection);
    if (selection instanceof IStructuredSelection) {
      IStructuredSelection structuredSelection = (IStructuredSelection) selection;
      return getAllElementOfType(structuredSelection.toList(), expectedType);
    } else if (selection instanceof TreeSelection) {
      TreeSelection treeSelection = (TreeSelection) selection;
      return getAllElementOfType(treeSelection.toList(), expectedType);
    }
    return null;
  }
  private String getOperationType(TreeSelection selection) {
    String operation = null;

    for (Iterator<?> i = selection.iterator(); i.hasNext(); ) {
      String tmpOperation = null;
      Object next = i.next();
      if (next instanceof GitModelWorkingFile) tmpOperation = STAGE_OP;
      else if (next instanceof GitModelCacheFile) tmpOperation = UNSTAGE_OP;
      else if (next instanceof GitModelCacheTree) {
        if (((GitModelCacheTree) next).isWorkingTree()) tmpOperation = STAGE_OP;
        else tmpOperation = UNSTAGE_OP;
      } else {
        operation = UNSUPPORTED_OP;
        break;
      }

      if (operation == null) operation = tmpOperation;
      else if (!operation.equals(tmpOperation)) {
        operation = UNSUPPORTED_OP;
        break;
      }
    }

    return operation;
  }
  @Override
  public void launch(ISelection selection, final String mode) {
    Activator.logInfo("launch shortcut: selection " + selection + " mode " + mode);

    if (selection != null) {
      if (selection instanceof TreeSelection) {
        TreeSelection ts = (TreeSelection) selection;

        Object e = ts.getFirstElement();

        if (e instanceof IFile) {
          IFile file = (IFile) e;
          final String fName = file.getProjectRelativePath().toOSString();
          final String pName = file.getProject().getName();
          launch(pName, fName, mode);
        }
      }
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see org.talend.designer.fileoutputxml.ui.footer.AbstractTreeNodeButton#handleSelectionEvent()
   */
  @Override
  protected void handleSelectionEvent(TreeSelection selection) {
    if (!selection.isEmpty()) {
      final Element parentNode = (Element) ((FOXTreeNode) selection.getFirstElement()).getParent();
      final List<? extends FOXTreeNode> attrChildren = parentNode.getAttributeChildren();
      final List<? extends FOXTreeNode> nameSpaceChildren = parentNode.getNameSpaceChildren();
      final List<FOXTreeNode> elementChildren = parentNode.getElementChildren();
      List<Integer> attrIndices = new ArrayList<Integer>();
      List<Integer> nameSpaceIndices = new ArrayList<Integer>();
      List<Integer> elementIndices = new ArrayList<Integer>();
      final Iterator iterator = selection.iterator();
      while (iterator.hasNext()) {
        final Object next = iterator.next();
        if (next instanceof Attribute) {
          if (attrChildren.contains(next)) {
            attrIndices.add(attrChildren.indexOf(next));
          }
        } else if (next instanceof NameSpaceNode) {
          if (nameSpaceChildren.contains(next)) {
            nameSpaceIndices.add(nameSpaceChildren.indexOf(next));
          }
        } else if (next instanceof Element) {
          if (elementChildren.contains(next)) {
            elementIndices.add(elementChildren.indexOf(next));
          }
        }
      }
      Collections.sort(attrIndices);
      Collections.sort(nameSpaceIndices);
      Collections.sort(elementIndices);

      swapElements(attrChildren, attrIndices);
      swapElements(nameSpaceChildren, nameSpaceIndices);
      swapElements(elementChildren, elementIndices);

      treeViewer.refresh(parentNode);
      treeViewer.expandAll();
      manager.getUiManager().getFoxUI().redrawLinkers();
      treeViewer.setSelection(selection);
    }
  }
Exemple #14
0
 public boolean equals(Object obj) {
   if (!(obj instanceof TreeSelection)) {
     // Fall back to super implementation, see bug 135837.
     return super.equals(obj);
   }
   TreeSelection selection = (TreeSelection) obj;
   int size = getPaths().length;
   if (selection.getPaths().length == size) {
     IElementComparer comparerOrNull =
         (getElementComparer() == selection.getElementComparer()) ? getElementComparer() : null;
     if (size > 0) {
       for (int i = 0; i < paths.length; i++) {
         if (!paths[i].equals(selection.paths[i], comparerOrNull)) {
           return false;
         }
       }
     }
     return true;
   }
   return false;
 }
 @Override
 public void widgetSelected(SelectionEvent e) {
   TreeViewer constTreeViewer = this.getViewPage().getConstTreeViewer();
   TreeViewer varTreeViewer = this.getViewPage().getVarTreeViewer();
   TreeSelection constSelect = (TreeSelection) constTreeViewer.getSelection();
   TreeSelection varSelect = (TreeSelection) varTreeViewer.getSelection();
   ConstBeanBridge atConst = null;
   VarBeanBridge beforeVar = null;
   //
   if (constSelect == null || constSelect.isEmpty() == true) return;
   atConst = (ConstBeanBridge) constSelect.getFirstElement();
   if (varSelect != null && varSelect.isEmpty() == false)
     beforeVar = (VarBeanBridge) varSelect.getFirstElement();
   //
   int index = -1;
   if (beforeVar != null) {
     atConst = beforeVar.getConst();
     index = atConst.getVarRoots().indexOf(beforeVar);
   }
   //
   VarBeanBridge newVar = new VarBeanBridge(atConst, null, atConst.getSource());
   atConst.addVar(index + 1, newVar);
   newVar.doEdit();
   varTreeViewer.refresh();
   varTreeViewer.setSelection(new TreeSelection(new TreePath(new Object[] {newVar})), true);
   varTreeViewer.editElement(newVar, 0);
 }
  @Override
  public void selectionChanged(SelectionChangedEvent event) {
    TreeSelection selection = (TreeSelection) event.getSelection();
    if (selection.isEmpty()) {
      this.selectedTranslator = null;
      this.translatorNameText.setText(UNDEFINED);
      updateOnSelection(null);
      return;
    }

    Object firstElement = selection.getFirstElement();

    if (!(firstElement instanceof TeiidTranslator)) {
      this.selectedTranslator = null;
      this.translatorNameText.setText(UNDEFINED);
    } else {
      this.selectedTranslator = (TeiidTranslator) selection.getFirstElement();
      this.translatorNameText.setText(selectedTranslator.getName());
    }

    updateOnSelection(firstElement);
  }
  public static Menu getContextMenu(
      ISelection selection,
      TreeViewer treeViewer,
      EngineMaintenanceMultiPageEditViewModelHandlerImpl modelHandler) {
    Menu result = new Menu(treeViewer.getTree());
    TreeSelection treeSelection = (TreeSelection) selection;
    Object firstElement = treeSelection.getFirstElement();
    if (firstElement instanceof MasterDetailTreeNode) {
      MasterDetailTreeNode treeNode = (MasterDetailTreeNode) firstElement;
      Datatype datatype = treeNode.getDatatype();

      // Menu 'new'
      Menu newElementMenu =
          createMenu(
              result,
              EngineMaintenanceMultiPageEditViewModelHandlerImpl.ID + NEW_ELEMENT,
              "icons/add.png");
      if (datatype instanceof TestEngineConfiguration) {
        Class<? extends Datatype>[] possibleChildrenTypes =
            getPossibleChildrenTypes((TestEngineConfiguration) datatype);

        addMenuItemsNew(newElementMenu, possibleChildrenTypes, treeNode, treeViewer, modelHandler);

        // Menu 'clone'
        Menu cloneElementMenu =
            createMenu(
                result,
                EngineMaintenanceMultiPageEditViewModelHandlerImpl.ID + CLONE_ELEMENT,
                "icons/copy.png");

        addMenuItemsClone(
            cloneElementMenu, possibleChildrenTypes, treeNode, treeViewer, modelHandler);

      } else if (datatype instanceof ProxyConfiguration) {
        Class<? extends Datatype>[] possibleChildrenTypes =
            getPossibleChildrenTypes((ProxyConfiguration) datatype);
        addMenuItemsNew(newElementMenu, possibleChildrenTypes, treeNode, treeViewer, modelHandler);
      } else if (datatype instanceof ConfigurationProperty) {
      } else {
        Activator.getDefault()
            .logError(
                "Error. No children-mapping for type '"
                    + datatype.getClass()
                    + "' in "
                    + EngineDataModelManager.class.getCanonicalName()
                    + " found.");
      }
      if (newElementMenu.getItemCount() == 0) {
        newElementMenu.getParentItem().setEnabled(false);
      }
      // If not root case
      if (treeNode.getParent() != null) {
        // Separator
        new MenuItem(result, SWT.SEPARATOR);

        // Remove
        Image image = ImageProvider.createImage("icons/delete.png");
        new RemoveDatatypeMenuItem(
            result,
            treeNode,
            modelHandler,
            treeViewer,
            EngineMaintenanceMultiPageEditViewModelHandlerImpl.ID + REMOVE,
            null,
            image);
      }
    }
    return result;
  }
Exemple #18
0
  @SuppressWarnings("unchecked")
  public void doubleClick(final DoubleClickEvent event) {
    TreeSelection selection = (TreeSelection) event.getSelection();
    Object o = selection.getFirstElement();
    if (o == null || o instanceof NoDatabaseRoot) {
      return;
    }

    // Try to find element to show
    HoogleResult result = null;
    if (o instanceof HoogleResult) {
      result = (HoogleResult) o;
    } else {
      Map.Entry<String, Object> entry = (Map.Entry<String, Object>) o;
      if (entry.getValue() instanceof HoogleResult) {
        result = (HoogleResult) entry.getValue();
      } else {
        // Show the first one (better than nothing)
        result = ((ArrayList<HoogleResult>) entry.getValue()).get(0);
      }
    }

    String url = null;
    switch (result.getType()) {
      case PACKAGE:
        HoogleResultPackage pkg = (HoogleResultPackage) result;
        url = HtmlUtil.generatePackageUrl(pkg.getPackage().getIdentifier());
        break;
      case MODULE:
        HoogleResultModule mod = (HoogleResultModule) result;
        url = HtmlUtil.generateModuleUrl(mod.getPackageIdentifiers().get(0), mod.getName());
        break;
      case CONSTRUCTOR:
        HoogleResultConstructor con = (HoogleResultConstructor) result;
        url =
            HtmlUtil.generateElementUrl(
                con.getPackageIdentifiers().get(0), con.getModule(), true, con.getName());
        break;
      case DECLARATION:
        HoogleResultDeclaration decl = (HoogleResultDeclaration) result;
        url =
            HtmlUtil.generateElementUrl(
                decl.getPackageIdentifiers().get(0),
                decl.getModule(),
                decl.getDeclaration().getType() == DeclarationType.FUNCTION,
                decl.getName());
        break;
    }

    // Open browser
    if (url != null) {
      try {
        IWorkbenchBrowserSupport browserSupport =
            this.getSite().getWorkbenchWindow().getWorkbench().getBrowserSupport();
        URL webUrl = new URL(url);
        IWebBrowser browser =
            browserSupport.createBrowser(
                IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR,
                null,
                "Haskell Browser",
                "Haskell Browser");
        browser.openURL(webUrl);
      } catch (Throwable ex) {
        // Do nothing
      }
    }
  }
Exemple #19
0
  @Override
  @SuppressWarnings("unchecked")
  public void doubleClick(final DoubleClickEvent event) {
    TreeSelection selection = (TreeSelection) event.getSelection();
    Object o = selection.getFirstElement();
    if (o == null || o instanceof NoDatabaseRoot) {
      return;
    }

    // Try to find element to show
    HoogleResult result = null;
    if (o instanceof HoogleResult) {
      result = (HoogleResult) o;
    } else {
      Map.Entry<String, Object> entry = (Map.Entry<String, Object>) o;
      if (entry.getValue() instanceof HoogleResult) {
        result = (HoogleResult) entry.getValue();
      } else {
        // Show the first one (better than nothing)
        result = ((ArrayList<HoogleResult>) entry.getValue()).get(0);
      }
    }
    IWorkbenchPage page = getSite().getPage();

    switch (result.getType()) {
      case KEYWORD:
        OpenDefinitionHandler.openExternalDefinition(
            page, null, null, null, result.getName(), null);
        break;
      case PACKAGE:
        HoogleResultPackage pkg = (HoogleResultPackage) result;
        OpenDefinitionHandler.openExternalDefinition(
            page, null, pkg.getPackage().getIdentifier().toString(), null, null, null);
        break;
      case MODULE:
        HoogleResultModule mod = (HoogleResultModule) result;
        OpenDefinitionHandler.openExternalDefinition(
            page, null, mod.getPackageIdentifiers().get(0).toString(), mod.getName(), null, null);
        break;
      case CONSTRUCTOR:
        HoogleResultConstructor con = (HoogleResultConstructor) result;
        OpenDefinitionHandler.openExternalDefinition(
            page,
            null,
            con.getPackageIdentifiers().get(0).toString(),
            con.getModule(),
            con.getName(),
            "v");
        break;
      case DECLARATION:
        HoogleResultDeclaration decl = (HoogleResultDeclaration) result;
        OpenDefinitionHandler.openExternalDefinition(
            page,
            null,
            decl.getPackageIdentifiers().get(0).toString(),
            decl.getModule(),
            decl.getName(),
            decl.getDeclaration().getType() == DeclarationType.FUNCTION ? "v" : "t");
        break;
      case WARNING: // not in tree
        break;
    }
  }
Exemple #20
0
  @Override
  @SuppressWarnings("unchecked")
  public void selectionChanged(final SelectionChangedEvent event) {
    TreeSelection selection = (TreeSelection) event.getSelection();

    Object o = selection.getFirstElement();
    if (o == null || o instanceof NoDatabaseRoot) {
      doc.setText("");
      return;
    }

    // Try to find element to show
    HoogleResult result = null;
    if (o instanceof HoogleResult) {
      result = (HoogleResult) o;
    } else {
      Map.Entry<String, Object> entry = (Map.Entry<String, Object>) o;
      if (entry.getValue() instanceof HoogleResult) {
        result = (HoogleResult) entry.getValue();
      }
    }

    if (result != null) {
      String text = "";
      switch (result.getType()) {
        case KEYWORD:
          text = HtmlUtil.generateDocument("keyword " + result.getName(), "");
          break;
        case PACKAGE:
          HaskellPackage pkg = ((HoogleResultPackage) result).getPackage();
          text =
              HtmlUtil.generateDocument("package " + pkg.getIdentifier().toString(), pkg.getDoc());
          break;
        case MODULE:
          HoogleResultModule mod = (HoogleResultModule) result;
          text =
              HtmlUtil.generateDocument(
                  "module " + mod.getName(),
                  mod.getPackageIdentifiers(),
                  null,
                  false,
                  mod.getModule().getDoc());
          break;
        case DECLARATION:
          HoogleResultDeclaration decl = (HoogleResultDeclaration) result;
          text =
              HtmlUtil.generateDocument(
                  decl.getDeclaration().getCompleteDefinition(),
                  decl.getPackageIdentifiers(),
                  decl.getModule(),
                  false,
                  decl.getDeclaration().getDoc());
          break;
        case CONSTRUCTOR:
          HoogleResultConstructor con = (HoogleResultConstructor) result;
          text =
              HtmlUtil.generateDocument(
                  con.getConstructor().getCompleteDefinition(),
                  con.getPackageIdentifiers(),
                  con.getModule(),
                  false,
                  con.getDeclaration().getDoc());
          break;
        case WARNING: // not in tree
          break;
      }

      doc.setText(text);
    } else {
      doc.setText(HtmlUtil.generateText(UITexts.browser_definedInSeveralLocations));
    }
  }
  /**
   * the command has been executed, so extract extract the needed information from the application
   * context.
   */
  public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);

    IWorkbenchPage activePage = window.getActivePage();
    ISelection selection = activePage.getSelection();
    if (selection != null && selection instanceof ITreeSelection) {
      TreeSelection treeSelection = (TreeSelection) selection;
      TreePath[] treePaths = treeSelection.getPaths();
      TreePath treePath = treePaths[0];

      Object firstSegmentObj = treePath.getFirstSegment();

      IProject project = (IProject) ((IAdaptable) firstSegmentObj).getAdapter(IProject.class);
      String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
      File projectDir = new File(workspacePath + File.separator + project.getName());

      // System.out.println("FireFox path: " + WebCLSDKPreferencePage.getFirefoxPath());
      // "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe";
      String nodejsPath = WebCLSDKPreferencePage.getNodeJSPath();
      if (nodejsPath == null || nodejsPath.isEmpty()) {
        MessageDialog.openWarning(
            window.getShell(),
            "High Web Warning - NodeJS Path",
            "NodeJS 경로가 세팅되어 있지 않습니다.\n"
                + "Window - Preferences - High Web Tool 에서 NodeJS 경로를 세팅해 주세요");
        return null;
      }

      String defaultWebBrwoserRegKey = "";
      try {
        defaultWebBrwoserRegKey =
            Utils.WindowsRegistry.getKeySz(
                Utils.WindowsRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Mozilla\\Firefox", "");
      } catch (java.util.prefs.BackingStoreException e) {
        try {
          defaultWebBrwoserRegKey =
              Utils.WindowsRegistry.getKeySz(
                  Utils.WindowsRegistry.HKEY_CURRENT_USER, "SOFTWARE\\Mozilla\\Firefox", "");
        } catch (java.util.prefs.BackingStoreException e1) {
          MessageDialog.openWarning(
              window.getShell(),
              "High Web Warning - Mozilla Firefox Installation",
              "Mozilla Firefox 브라우저가 설치되어 있지 않습니다.\n"
                  + "Mozilla Firefox 3.3 버전 및 Nokia WebCL Extension을 설치해 주세요");
          return null;
        }
      }

      String firefoxPath = WebCLSDKPreferencePage.getFirefoxPath();
      if (firefoxPath == null || firefoxPath.isEmpty()) {
        MessageDialog.openWarning(
            window.getShell(),
            "High Web Warning - Firefox Path",
            "Firefox 경로가 세팅되어 있지 않습니다.\n"
                + "Window - Preferences - High Web Tool 에서 Firefox 경로를 세팅해 주세요");
        return null;
      }

      ProcessBuilder pBuilder = null;

      try {
        String progFilesx86Dir = System.getenv("ProgramFiles(x86)");
        String helper =
            progFilesx86Dir
                + File.separator
                + "Mozilla Firefox"
                + File.separator
                + "uninstall"
                + File.separator
                + "helper.exe";
        pBuilder = new ProcessBuilder(new String[] {helper, "/SetAsDefaultAppUser"});
        pBuilder.redirectErrorStream(true);
        Process proc = pBuilder.start();
        proc.waitFor();
      } catch (Exception e) {
        e.printStackTrace();
      }

      try {
        Process proc = null;
        if (Activator.nodejsProcess != null && Activator.nodejsProcess.isAlive()) {
          String url = "http://localhost:4400/?enableripple=true";
          pBuilder = new ProcessBuilder(new String[] {firefoxPath, url});
          pBuilder.redirectErrorStream(true);
          proc = pBuilder.start();
        } else {
          String webContentPath = projectDir.getAbsolutePath() + File.separator + "WebContent";
          String appdata = System.getenv("APPDATA");
          String ripple =
              appdata
                  + File.separator
                  + "npm"
                  + File.separator
                  + "node_modules"
                  + File.separator
                  + "ripple-emulator"
                  + File.separator
                  + "bin"
                  + File.separator
                  + "ripple";
          String rippleArg = "emulate";
          pBuilder = new ProcessBuilder(new String[] {nodejsPath, ripple, rippleArg});
          pBuilder.redirectErrorStream(true);
          pBuilder.directory(new File(webContentPath));
          proc = pBuilder.start();
          Activator.nodejsProcess = proc;
        }
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    return null;
  }