Search Results

Search found 29 results on 2 pages for 'darkie15'.

Page 2/2 | < Previous Page | 1 2 

  • Adding figures using contextual menu - Eclipse GEF

    - by darkie15
    All, I am creating a palette less eclipse plugin where am adding figures to the custom editor through the contextual menu, but am not finding a way to do it. Can anyone please guide me as to how to go about adding figures to editor dynamically through context menu i.e. adding actions/commands. Since Eclipse GEF plugin development finds so less examples to look at, I am adding my solution so others find it useful. This code helps to render a node to the editor. Source code for Action class to render figures to the editor: public class AddNodeAction extends EditorPartAction { public static final String ADD_NODE = "ADDNODE"; public AddNodeAction(IEditorPart editor) { super(editor); setText("Add a Node"); setId(ADD_NODE); // Important to set ID } public void run() { <ParentModelClass> parent= (<ParentModelClass>)getEditorPart().getAdapter(<ParentModelClass>.class); if (parent== null) return; CommandStack command = (CommandStack)getEditorPart().getAdapter(CommandStack.class); if (command != null) { CompoundCommand totalCmd = new CompoundCommand(); <ChildModelToRenderFigureCommand>cmd = new <ChildModelToRenderFigureCommand>(parent); cmd.setParent(parent); <ChildModelClass> newNode = new <ChildModelClass>(); cmd.setNode(newNode); cmd.setLocation(getLocation()); // Any location you wish to set to totalCmd.add(cmd); command.execute(totalCmd); } } @Override protected boolean calculateEnabled() { return true; } }

    Read the article

  • Understanding the concept of Inodes

    - by darkie15
    Hi All, I am referring to the link: http://www.tux4u.nl/freedocs/unix/draw/inode.pdf I am confused on parts: 1 12 direct block pointers 2 1 single indirect block pointer 3 1 double indirect block pointer 4 1 triple indirect block pointer Now the diagram says that each pointer is 32/64 bits. [Query]: Why and how are these values inferred? I mean why specifically have only 32 or 64 bit pointers? The diagram says, One data block{8 KB} for each pointer {4 bytes/8 bytes} [Query]: How does this actually work out? i.e. 8*1024 bytes / 8 bytes = 1024 bytes? What is the logic behind having a 8 bytes pointer for 8KB block? Regards, darkie.

    Read the article

  • Query on the scope of local variables in C

    - by darkie15
    All, Consider the following code: void func(void) { int a; printf ("%d", a); } int main(int argc, char **argv) { int a = 3; func(); printf("%d", a); } According to my understanding, the output should be: <junk value><3> Can anyone please confirm my understanding? My basic query is, does the compiler refer to the outer scope for a variable that has been declared but not defined? Regards, darkie

    Read the article

  • Pointers in C with binary file

    - by darkie15
    Hi All, I am reading the contents of the file using fread into an char array. But I am not sure why it is not getting printed in the output. Here is the code: void getInfo(FILE* inputFile) { char chunk[4]; int liIndex; for (liIndex = 0 ; liIndex < 4 ; liIndex++) { fread(chunk, sizeof(char), 4, inputFile); } printf("\n chunk %s", chunk); } Output prints nothing at all. Where am I going wrong? Regards , darkie

    Read the article

< Previous Page | 1 2