Examples of IEditor


Examples of net.sourceforge.marathon.editor.IEditor

        int n = 0;
        DockableState[] dockables = workspace.getDockables();
        for (DockableState dockableState : dockables) {
            Dockable dockable = dockableState.getDockable();
            if (dockable instanceof EditorDockable) {
                IEditor editor = ((EditorDockable) dockable).getEditor();
                if (editor.isDirty()) {
                    n++;
                }
            }
        }
        return n;
View Full Code Here

Examples of net.sourceforge.marathon.editor.IEditor

    private boolean saveFileIfNeeded() {
        DockableState[] dockables = workspace.getDockables();
        for (DockableState dockableState : dockables) {
            Dockable dockable = dockableState.getDockable();
            if (dockable instanceof EditorDockable) {
                IEditor editor = ((EditorDockable) dockable).getEditor();
                if (editor.isDirty()) {
                    if (!closeEditor(editor))
                        return false;
                }
            }
        }
View Full Code Here

Examples of net.sourceforge.marathon.editor.IEditor

    private String getModuleHeader(String functionName, String description) {
        return scriptModel.getModuleHeader(functionName, description);
    }

    public IEditor newFile(String script, File directory) {
        IEditor newEditor = createEditor(IEditorProvider.EditorType.OTHER);
        getFileHandler(newEditor).setCurrentDirectory(directory);
        getFileHandler(newEditor).clearCurrentFile();
        String newFileName = newFileNameGenerator.getNewFileName();
        newEditor.setText(script);
        newEditor.setMode(getFileHandler(newEditor).getMode(newFileName));
        newEditor.setData("filename", newFileName);
        newEditor.clearUndo();
        newEditor.setDirty(false);
        setCurrentEditorDockable((EditorDockable) newEditor.getData("dockable"));
        newEditor.setFocus();
        return newEditor;
    }
View Full Code Here

Examples of net.sourceforge.marathon.editor.IEditor

        final EditorDockable dockable = findEditorDockable(file);
        if (dockable != null) {
            selectDockable(dockable);
            return;
        }
        IEditor openEditor = createEditor(file);
        if (openEditor != null) {
            setCurrentEditorDockable((EditorDockable) openEditor.getData("dockable"));
            openEditor.setFocus();
        }
    }
View Full Code Here

Examples of net.sourceforge.marathon.editor.IEditor

    public void saveAll() {
        DockableState[] dockables = workspace.getDockables();
        for (DockableState dockableState : dockables) {
            Dockable dockable = dockableState.getDockable();
            if (dockable instanceof EditorDockable) {
                IEditor editor = ((EditorDockable) dockable).getEditor();
                if (editor.isDirty()) {
                    save(editor);
                }
            }
        }
        updateView();
View Full Code Here

Examples of net.sourceforge.marathon.editor.IEditor

    private IEditor createEditor(EditorType editorType) {
        try {
            FileHandler fileHandler = new FileHandler(new MarathonFileFilter(scriptModel.getSuffix(), scriptModel), new File(
                    System.getProperty(Constants.PROP_TEST_DIR)), new File(System.getProperty(Constants.PROP_FIXTURE_DIR)),
                    Constants.getMarathonDirectories(Constants.PROP_MODULE_DIRS), this);
            IEditor e = editorProvider.get(true, 1, editorType);
            e.setData("filehandler", fileHandler);
            e.addGutterListener(gutterListener);
            e.addContentChangeListener(contentChangeListener);
            e.addCaretListener(caretListener);
            setAcceleratorKeys(e);
            setMenuItems(e);
            e.setStatusBar(statusPanel);
            Dockable editorDockable = new EditorDockable(e, editorDockGroup, workspace);
            e.setData("dockable", editorDockable);
            return e;
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        return null;
View Full Code Here

Examples of net.sourceforge.marathon.editor.IEditor

            } else if (file.getName().endsWith(".suite")) {
                editorType = IEditorProvider.EditorType.SUITE;
            } else {
                editorType = IEditorProvider.EditorType.OTHER;
            }
            IEditor e = createEditor(editorType);
            String script = getFileHandler(e).readFile(file);
            if (script != null) {
                String name = getFileHandler(e).getCurrentFile().getName();
                e.setText(script);
                e.setMode(getFileHandler(e).getMode(name));
                e.setData("filename", name);
                e.setCaretLine(0);
                e.setDirty(false);
            }
            e.clearUndo();
            return e;
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return null;
View Full Code Here

Examples of net.sourceforge.marathon.editor.IEditor

            }
        });
        ButtonBarBuilder2 builder = new ButtonBarBuilder2();
        builder.addButton(closeButton);
        getContentPane().add(builder.getPanel(), BorderLayout.SOUTH);
        IEditor editor = editorProvider.get(true, 1, EditorType.OTHER);
        editor.setText(message);
        editor.setEditable(false);
        getContentPane().add(new JScrollPane(editor.getComponent()));
        getContentPane().setPreferredSize(new Dimension(640, 480));
        pack();
        setLocationRelativeTo(null);
    }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.IEditor

  }

  private void startEditComponent(Component hovered, Point loc) {
    WidgetAdapter adapter = WidgetAdapter.getWidgetAdapter(hovered);
    IEditorAdapter editorAdapter = (IEditorAdapter) adapter.getAdapter(IEditorAdapter.class);
    IEditor iEditor = null;
    if (editorAdapter != null) {
      editorAdapter.setHotspot(loc);
      iEditor = editorAdapter.getEditorAt();
    }
    if (iEditor != null) {
      iEditor.setFont(adapter.getWidget().getFont());
      iEditor.setValue(editorAdapter.getWidgetValue());
      iEditor.addChangeListener(this);
      Rectangle bounds = editorAdapter.getEditorBounds();
      bounds = SwingUtilities.convertRectangle(hovered, bounds, designer);
      Component comp = iEditor.getComponent();
      Font f = adapter.getWidget().getFont();
      if (f != null) {
        comp.setFont(f);
      }
      comp.setBounds(bounds);
      comp.doLayout();
      glassPlane.add(comp);
      comp.addFocusListener(this);
      glassPlane.validate();
      glassPlane.repaint();
      comp.repaint();
      iEditor.setFocus();
      currentEditor = new EditorAdapter(adapter, iEditor);
    }
  }
View Full Code Here

Examples of org.dyno.visual.swing.plugin.spi.IEditor

  private boolean _stopEditing(boolean silence) {
    if (currentEditor != null) {
      stoppingEditing = true;
      WidgetAdapter adapter = currentEditor.getAdapter();
      IEditor iEditor = currentEditor.getEditor();
      try {
        iEditor.validateValue();
        Object newValue = iEditor.getValue();
        Object oldValue = iEditor.getOldValue();
        if (isValueChanged(oldValue, newValue)) {
          IUndoableOperation operation = new SetWidgetValueOperation(adapter, oldValue, newValue);
          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
          operation.addContext(adapter.getUndoContext());
          operationHistory.execute(operation, null, null);
          adapter.setDirty(true);
          CompositeAdapter container = (CompositeAdapter) adapter.getParentAdapter();
          if (container != null)
            container.adjustLayout(adapter.getWidget());
          if (adapter.isSelected()) {
            designer.publishSelection();
          }
        }
        iEditor.removeChangeListener(this);
        iEditor.getComponent().removeFocusListener(this);
        iEditor.getComponent().transferFocus();
        glassPlane.remove(iEditor.getComponent());
        glassPlane.validate();
        designer.repaint();
        currentEditor = null;
        return true;
      } catch (Exception e) {
        if (silence) {
          iEditor.removeChangeListener(this);
          iEditor.getComponent().removeFocusListener(this);
          glassPlane.remove(iEditor.getComponent());
          glassPlane.validate();
          currentEditor = null;
        } else {
          final String message = e.getMessage();
          final Shell shell = JavaUtil.getEclipseShell();
          shell.getDisplay().syncExec(new Runnable() {
           
            public void run() {
              MessageDialog.openError(shell, Messages.GLASS_TARGET_VALIDATION_ERROR, message);
            }
          });
          iEditor.getComponent().requestFocus();
        }
        return false;
      } finally {
        stoppingEditing = false;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.