コード例 #1
0
 private String getLineDelimiter() {
   BundleInputContext inputContext = getBundleContext();
   if (inputContext != null) {
     return inputContext.getLineDelimiter();
   }
   return System.getProperty("line.separator"); // $NON-NLS-1$
 }
コード例 #2
0
 private void handleDelete() {
   IStructuredSelection ssel = (IStructuredSelection) fPluginTable.getSelection();
   if (ssel.size() > 0) {
     Object[] objects = ssel.toArray();
     IProductPlugin[] plugins = new IProductPlugin[objects.length];
     System.arraycopy(objects, 0, plugins, 0, objects.length);
     getProduct().removePlugins(plugins);
     updateRemoveButtons(true, true);
   }
 }
コード例 #3
0
 /**
  * Return the computer full name. <br>
  *
  * @return the name or <b>null</b> if the name cannot be found
  */
 public static String getComputerFullName() {
   String uname = System.getProperty("user.name");
   if (uname == null || uname.isEmpty()) {
     try {
       final InetAddress addr = InetAddress.getLocalHost();
       uname = addr.getHostName();
     } catch (final Exception e) {
     }
   }
   return uname;
 }
コード例 #4
0
ファイル: SootLauncher.java プロジェクト: safdariqbal/soot
  private void initPaths() {

    sootClasspath.initialize();

    // platform location
    platform_location = getSootSelection().getJavaProject().getProject().getLocation().toOSString();
    platform_location =
        platform_location.substring(
            0, platform_location.lastIndexOf(System.getProperty("file.separator")));
    // external jars location - may need to change don't think I use this anymore
    setOutputLocation(
        platform_location + getFileHandler().getSootOutputFolder().getFullPath().toOSString());
  }
コード例 #5
0
  protected void setupPortEditors() {
    viewer.setCellEditors(new CellEditor[] {null, new TextCellEditor(ports)});

    ICellModifier cellModifier =
        new ICellModifier() {
          public Object getValue(Object element, String property) {
            ServerPort sp = (ServerPort) element;
            if (sp.getPort() < 0) return "-";
            return sp.getPort() + "";
          }

          public boolean canModify(Object element, String property) {
            if ("port".equals(property)) return true;

            return false;
          }

          public void modify(Object element, String property, Object value) {
            try {
              Item item = (Item) element;
              ServerPort sp = (ServerPort) item.getData();
              int port = Integer.parseInt((String) value);
              execute(new ModifyPortCommand(tomcatConfiguration, sp.getId(), port));
            } catch (Exception ex) {
              // ignore
            }
          }
        };
    viewer.setCellModifier(cellModifier);

    // preselect second column (Windows-only)
    String os = System.getProperty("os.name");
    if (os != null && os.toLowerCase().indexOf("win") >= 0) {
      ports.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
              try {
                int n = ports.getSelectionIndex();
                viewer.editElement(ports.getItem(n).getData(), 1);
              } catch (Exception e) {
                // ignore
              }
            }
          });
    }
  }
コード例 #6
0
 @Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
   ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
   if (part instanceof MarketDataView && selection instanceof IStructuredSelection) {
     MarketDataView view = (MarketDataView) part;
     IStructuredSelection sselection = (IStructuredSelection) selection;
     StringBuilder builder = new StringBuilder();
     for (Object obj : sselection.toArray()) {
       if (obj instanceof MarketDataViewItem) {
         MarketDataViewItem item = (MarketDataViewItem) obj;
         builder.append(item);
         builder.append(System.getProperty("line.separator")); // $NON-NLS-1$
       }
     }
     view.getClipboard()
         .setContents(
             new Object[] {builder.toString()}, new Transfer[] {TextTransfer.getInstance()});
   }
   return null;
 }